Skip to content

Commit

Permalink
Release v1.4.0. Major docker improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekSredzki committed Dec 6, 2016
1 parent d95665c commit f51f476
Show file tree
Hide file tree
Showing 6 changed files with 227 additions and 42 deletions.
25 changes: 18 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
FROM node
FROM node:6

COPY package.json .bowerrc bower.json ./
RUN npm install \
&& ./node_modules/.bin/bower install --allow-root \
&& npm cache clean
COPY . .
# Create app directory
RUN mkdir -p /usr/src/electron-release-server
WORKDIR /usr/src/electron-release-server

CMD sh -c 'cp config/docker.js config/local.js && npm start'
# Install app dependencies
COPY package.json .bowerrc bower.json /usr/src/electron-release-server/
RUN npm install
RUN ./node_modules/.bin/bower install --allow-root
RUN npm cache clean

# Bundle app source
COPY . /usr/src/electron-release-server

COPY config/docker.js config/local.js

EXPOSE 80

CMD [ "npm", "start" ]
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ _Note: Despite being advertised as a release server for Electron applications, i
If you host your project on your Github **and** do not need a UI for your app, then [Nuts](https://github.com/GitbookIO/nuts) is probably what you're looking for. Otherwise, you're in the same boat as I was, and you've found the right place!

## Features
- :sparkles: Docker :whale: support (thanks to EvgeneOskin)!
- :sparkles: Awesome release management interface powered by [AngularJS](https://angularjs.org)
- Authenticates with LDAP, easy to modify to another authentication method if needed
- :sparkles: Store assets on server disk, or Amazon S3 (with minor modifications)
Expand Down
30 changes: 15 additions & 15 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@
"name": "electron-release-server",
"private": true,
"dependencies": {
"angular": "^1.5.8",
"angular": "^1.5.9",
"bootstrap-sass-official": "^3.3.7",
"angular-animate": "^1.5.8",
"angular-messages": "^1.5.8",
"angular-route": "^1.5.8",
"angular-sanitize": "^1.5.8",
"angular-xeditable": "~0.2.0",
"lodash": "~4.14.0",
"angular-animate": "^1.5.9",
"angular-messages": "^1.5.9",
"angular-route": "^1.5.9",
"angular-sanitize": "^1.5.9",
"angular-xeditable": "~0.5.0",
"lodash": "~4.17.2",
"angular-ui-notification": "~0.2.0",
"angular-bootstrap": "~1.3.3",
"angular-confirm-modal": "^1.2.5",
"angular-jwt": "^0.0.9",
"ngstorage": "^0.3.10",
"angular-confirm-modal": "^1.2.6",
"angular-jwt": "^0.1.8",
"ngstorage": "^0.3.11",
"sails.io.js": "*",
"angular-sails": "^1.1.4",
"angular-moment": "^1.0.0-beta.3",
"components-font-awesome": "^4.6.3",
"ng-file-upload": "^12.0.4",
"angular-moment": "^1.0.1",
"components-font-awesome": "^4.7.0",
"ng-file-upload": "^12.2.13",
"angular-PubSub": "angular.pubsub#*",
"ng-device-detector": "^3.0.1",
"compare-versions": "^2.0.2"
"compare-versions": "^3.0.0"
},
"appPath": "app",
"overrides": {
Expand All @@ -38,6 +38,6 @@
}
},
"resolutions": {
"angular": "^1.5.8"
"angular": "^1.5.9"
}
}
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ services:
DB_NAME: releaseserver
DB_PASSWORD: secret
TOKEN_SECRET: change_me_in_production
LOG_LEVEL: debug
APP_URL: 'localhost:5000'
depends_on:
- db
ports:
- "5000:80"
- '5000:80'
entrypoint: ./scripts/wait.sh db:5432 -- npm start
db:
image: postgres
environment:
Expand Down
36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
{
"name": "electron-release-server",
"private": true,
"version": "1.3.1",
"version": "1.4.0",
"description": "A version server for hosting and serving the your electron desktop app releases.",
"dependencies": {
"bluebird": "^3.4.1",
"bower": "^1.7.9",
"express-useragent": "^0.2.4",
"fs-extra": "^0.30.0",
"bluebird": "^3.4.6",
"bower": "^1.8.0",
"express-useragent": "^1.0.4",
"fs-extra": "^1.0.0",
"grunt": "^1.0.1",
"grunt-contrib-clean": "~1.0.0",
"grunt-contrib-coffee": "~1.0.0",
"grunt-contrib-concat": "~1.0.1",
"grunt-contrib-copy": "~1.0.0",
"grunt-contrib-cssmin": "~1.0.1",
"grunt-contrib-cssmin": "~1.0.2",
"grunt-contrib-jst": "~1.0.0",
"grunt-contrib-less": "1.3.0",
"grunt-contrib-less": "1.4.0",
"grunt-contrib-pug": "^1.0.0",
"grunt-contrib-uglify": "~2.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt-sails-linker": "~0.10.1",
"grunt-sass": "^1.2.0",
"grunt-sync": "~0.5.2",
"grunt-sails-linker": "~1.0.4",
"grunt-sass": "^1.2.1",
"grunt-sync": "~0.6.2",
"grunt-wiredep": "^3.0.1",
"include-all": "~0.1.6",
"jsonwebtoken": "^7.1.6",
"ldapauth-fork": "^2.5.2",
"lodash": "^4.14.0",
"include-all": "~2.0.0",
"jsonwebtoken": "^7.1.9",
"ldapauth-fork": "^2.5.4",
"lodash": "^4.17.2",
"mime": "^1.3.4",
"passport": "^0.3.2",
"passport-ldapauth": "^0.5.0",
"pug": "^2.0.0-beta4",
"passport-ldapauth": "^0.6.0",
"pug": "^2.0.0-beta6",
"rc": "~1.1.6",
"sails": "^0.12.4",
"sails": "^0.12.11",
"sails-disk": "^0.10.10",
"sails-pg-session": "^1.0.1",
"sails-postgresql": "^0.12.1",
"semver": "^5.3.0",
"skipper-disk": "^0.5.4",
"skipper-disk": "^0.5.7",
"strip-bom": "^3.0.0",
"url": "^0.11.0"
},
Expand Down
173 changes: 173 additions & 0 deletions scripts/wait.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/usr/bin/env bash
# Use this script to test if a given TCP host/port are available

# OSX doesn't have the timeout command but it can be installed using homebrew.
# Check if the gtimeout command exists and, if needed, tell the user how to
# install it.
timeout_cmd="timeout"
if [ $(uname -s) = "Darwin" ]; then
timeout_cmd="gtimeout"
if ! which $timeout_cmd 2>&1 >/dev/null; then
echo "Can't find the command 'gtimeout'. Run 'brew install coreutils' to install it."
exit 1
fi
fi

cmdname=$(basename $0)

echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }

usage()
{
cat << USAGE >&2
Usage:
$cmdname host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST Host or IP under test
-p PORT | --port=PORT TCP port under test
Alternatively, you specify the host and port as host:port
-s | --strict Only execute subcommand if the test succeeds
-q | --quiet Don\'t output any status messages
-t TIMEOUT | --timeout=TIMEOUT
Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
USAGE
exit 1
}

wait_for()
{
if [[ $TIMEOUT -gt 0 ]]; then
echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT"
else
echoerr "$cmdname: waiting for $HOST:$PORT without a timeout"
fi
start_ts=$(date +%s)
while :
do
(echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1
result=$?
if [[ $result -eq 0 ]]; then
end_ts=$(date +%s)
echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds"
break
fi
sleep 1
done
return $result
}

wait_for_wrapper()
{
# In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
if [[ $QUIET -eq 1 ]]; then
$timeout_cmd $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
else
$timeout_cmd $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT &
fi
PID=$!
trap "kill -INT -$PID" INT
wait $PID
RESULT=$?
if [[ $RESULT -ne 0 ]]; then
echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT"
fi
return $RESULT
}

# process arguments
while [[ $# -gt 0 ]]
do
case "$1" in
*:* )
hostport=(${1//:/ })
HOST=${hostport[0]}
PORT=${hostport[1]}
shift 1
;;
--child)
CHILD=1
shift 1
;;
-q | --quiet)
QUIET=1
shift 1
;;
-s | --strict)
STRICT=1
shift 1
;;
-h)
HOST="$2"
if [[ $HOST == "" ]]; then break; fi
shift 2
;;
--host=*)
HOST="${1#*=}"
shift 1
;;
-p)
PORT="$2"
if [[ $PORT == "" ]]; then break; fi
shift 2
;;
--port=*)
PORT="${1#*=}"
shift 1
;;
-t)
TIMEOUT="$2"
if [[ $TIMEOUT == "" ]]; then break; fi
shift 2
;;
--timeout=*)
TIMEOUT="${1#*=}"
shift 1
;;
--)
shift
CLI="$@"
break
;;
--help)
usage
;;
*)
echoerr "Unknown argument: $1"
usage
;;
esac
done

if [[ "$HOST" == "" || "$PORT" == "" ]]; then
echoerr "Error: you need to provide a host and port to test."
usage
fi

TIMEOUT=${TIMEOUT:-15}
STRICT=${STRICT:-0}
CHILD=${CHILD:-0}
QUIET=${QUIET:-0}

if [[ $CHILD -gt 0 ]]; then
wait_for
RESULT=$?
exit $RESULT
else
if [[ $TIMEOUT -gt 0 ]]; then
wait_for_wrapper
RESULT=$?
else
wait_for
RESULT=$?
fi
fi

if [[ $CLI != "" ]]; then
if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then
echoerr "$cmdname: strict mode, refusing to execute subprocess"
exit $RESULT
fi
exec $CLI
else
exit $RESULT
fi

0 comments on commit f51f476

Please sign in to comment.