Skip to content

Commit

Permalink
simplify containers to be as lightest as possible
Browse files Browse the repository at this point in the history
  • Loading branch information
STAFYNIAK Sacha committed Oct 6, 2016
1 parent 14ee904 commit 578c02c
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 89 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Expand Up @@ -2,6 +2,5 @@ node_modules
dump
vagrant
Vagrantfile
coverage
.git
.idea
1 change: 1 addition & 0 deletions Dockerfile
Expand Up @@ -12,6 +12,7 @@ RUN apt-get update && apt-get install -y \
g++ \
python && \
npm install && \
node bin/kuzzle plugins --install && \
apt-get clean && \
apt-get remove -y \
build-essential \
Expand Down
2 changes: 0 additions & 2 deletions bin/commands/install.js
Expand Up @@ -32,5 +32,3 @@ module.exports = function () {
process.exit(1);
});
};


32 changes: 0 additions & 32 deletions docker-compose/debug.yml

This file was deleted.

3 changes: 1 addition & 2 deletions docker-compose/dev.yml
Expand Up @@ -2,7 +2,6 @@ proxy:
image: kuzzleio/proxy
ports:
- "7511-7513:7511-7513"
- "8083:8080"

kuzzle:
image: kuzzleio/dev
Expand All @@ -18,11 +17,11 @@ kuzzle:
- redis
- proxy
environment:
- FEATURE_COVERAGE
- kuzzle_services__db__host=elasticsearch
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_services__proxyBroker__host=proxy
- FEATURE_COVERAGE=1

redis:
image: redis:3.2-alpine
Expand Down
15 changes: 8 additions & 7 deletions docker-compose/scripts/run-dev.sh
Expand Up @@ -2,29 +2,30 @@

ELASTIC=${READ_ENGINE_HOST:-elasticsearch:9200}

echo "Waiting for elasticsearch to be available"
echo "[$(date --rfc-3339 seconds)] - Waiting for elasticsearch to be available"
while ! curl -f -s -o /dev/null "http://$ELASTIC"
do
echo "$(date) - still trying connecting to http://$ELASTIC"
echo "[$(date --rfc-3339 seconds)] - still trying connecting to http://$ELASTIC"
sleep 1
done
# create a tmp index just to force the shards to init
curl -XPUT -s -o /dev/null "http://$ELASTIC/%25___tmp"
echo "Elasticsearch is up. Waiting for shards to be active (can take a while)"
echo "[$(date --rfc-3339 seconds)] - Elasticsearch is up. Waiting for shards to be active (can take a while)"
E=$(curl -s "http://${ELASTIC}/_cluster/health?wait_for_status=yellow&wait_for_active_shards=1&timeout=60s")
curl -XDELETE -s -o /dev/null "http://$ELASTIC/%25___tmp"

if ! (echo ${E} | grep -E '"status":"(yellow|green)"' > /dev/null); then
echo "Could not connect to elasticsearch in time. Aborting..."
echo "[$(date --rfc-3339 seconds)] - Could not connect to elasticsearch in time. Aborting..."
exit 1
fi

npm install

echo "Starting Kuzzle..."
echo "" > node_modules/pm2/lib/keymetrics
echo "[$(date --rfc-3339 seconds)] - Starting Kuzzle..."

node bin/kuzzle install
pm2 start /config/pm2.json --silent
pm2 start --silent /config/pm2.json
nohup node-inspector --web-port=8080 --debug-port=7000 > /dev/null 2>&1&
pm2 sendSignal -s SIGUSR1 KuzzleServer
pm2 logs
pm2 logs --lines 0 --raw
13 changes: 7 additions & 6 deletions docker-compose/scripts/run-test.sh
Expand Up @@ -2,27 +2,28 @@

ELASTIC=${READ_ENGINE_HOST:-elasticsearch:9200}

echo "Waiting for elasticsearch to be available"
echo "[$(date --rfc-3339 seconds)] - Waiting for elasticsearch to be available"
while ! curl -f -s -o /dev/null "http://$ELASTIC"
do
echo "$(date) - still trying connecting to http://$ELASTIC"
echo "[$(date --rfc-3339 seconds)] - still trying connecting to http://$ELASTIC"
sleep 1
done
# create a tmp index just to force the shards to init
curl -XPUT -s -o /dev/null "http://$ELASTIC/%25___tmp"
echo "Elasticsearch is up. Waiting for shards to be active (can take a while)"
echo "[$(date --rfc-3339 seconds)] - Elasticsearch is up. Waiting for shards to be active (can take a while)"
E=$(curl -s "http://${ELASTIC}/_cluster/health?wait_for_status=yellow&wait_for_active_shards=1&timeout=60s")
curl -XDELETE -s -o /dev/null "http://$ELASTIC/%25___tmp"

if ! (echo ${E} | grep -E '"status":"(yellow|green)"' > /dev/null); then
echo "Could not connect to elasticsearch in time. Aborting..."
echo "[$(date --rfc-3339 seconds)] - Could not connect to elasticsearch in time. Aborting..."
exit 1
fi

npm install

echo "Starting Kuzzle..."
echo "" > node_modules/pm2/lib/keymetrics
echo "[$(date --rfc-3339 seconds)] - Starting Kuzzle..."

node bin/kuzzle install
pm2 start /config/pm2.json --silent
pm2 start --silent /config/pm2.json
npm test
15 changes: 8 additions & 7 deletions docker-compose/scripts/run.sh
Expand Up @@ -2,27 +2,28 @@

ELASTIC=${READ_ENGINE_HOST:-elasticsearch:9200}

echo "Waiting for elasticsearch to be available"
echo "[$(date --rfc-3339 seconds)] - Waiting for elasticsearch to be available"
while ! curl -f -s -o /dev/null "http://$ELASTIC"
do
echo "$(date) - still trying connecting to http://$ELASTIC"
echo "[$(date --rfc-3339 seconds)] - still trying connecting to http://$ELASTIC"
sleep 1
done
# create a tmp index just to force the shards to init
curl -XPUT -s -o /dev/null "http://$ELASTIC/%25___tmp"
echo "Elasticsearch is up. Waiting for shards to be active (can take a while)"
echo "[$(date --rfc-3339 seconds)] - Elasticsearch is up. Waiting for shards to be active (can take a while)"
E=$(curl -s "http://${ELASTIC}/_cluster/health?wait_for_status=yellow&wait_for_active_shards=1&timeout=60s")
curl -XDELETE -s -o /dev/null "http://$ELASTIC/%25___tmp"

if ! (echo ${E} | grep -E '"status":"(yellow|green)"' > /dev/null); then
echo "Could not connect to elasticsearch in time. Aborting..."
echo "[$(date --rfc-3339 seconds)] - Could not connect to elasticsearch in time. Aborting..."
exit 1
fi

npm install

echo "Starting Kuzzle..."
echo "" > node_modules/pm2/lib/keymetrics
echo "[$(date --rfc-3339 seconds)] - Starting Kuzzle..."

node bin/kuzzle install
pm2 start /config/pm2.json --silent
pm2 logs
pm2 start --silent /config/pm2.json
pm2 logs --lines 0 --raw
8 changes: 4 additions & 4 deletions docker-compose/test-travis.yml
Expand Up @@ -15,6 +15,10 @@ kuzzle:
- redis
- proxy
environment:
- kuzzle_services__db__host=elasticsearch
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_services__proxyBroker__host=proxy
- FEATURE_COVERAGE=1
# Travis env var must be propagated into the container
- TRAVIS
Expand All @@ -24,10 +28,6 @@ kuzzle:
- TRAVIS_JOB_ID
- TRAVIS_PULL_REQUEST
- TRAVIS_REPO_SLUG
- kuzzle_services__db__host=elasticsearch
- kuzzle_services__internalCache__node__host=redis
- kuzzle_services__memoryStorage__node__host=redis
- kuzzle_services__proxyBroker__host=proxy

redis:
image: redis:3.2-alpine
Expand Down
28 changes: 0 additions & 28 deletions docker-compose/test.yml

This file was deleted.

0 comments on commit 578c02c

Please sign in to comment.