Created
October 15, 2018 10:04
-
-
Save PieterScheffers/c9d477a02f5d99e69fe4223971044239 to your computer and use it in GitHub Desktop.
Compose multiple service like docker-compose without docker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p logs | |
npm install | |
lerna bootstrap | |
# Start RabbitMQ / Redis and Mongodb | |
docker-compose -f docker/docker-compose.yml up -d | |
sleep 10 | |
# trap 'kill 0' SIGINT | |
( | |
echo "Starting microservice_one..." | |
cd microservices/microservice_one | |
# Export all environment variables for this microservice | |
export PORT=7001 | |
export MICROSERVICE_ONE_ENV=true | |
export NODE_ENV=development | |
export RABBIT_MQ_URL=amqp://guest:guest@localhost:5672 | |
export MONGODB_URL=mongodb://localhost:27017/development | |
export REDIS_URL=redis://localhost | |
# start microservice | |
node_modules/.bin/nodemon src/server.js & | |
# redirect all output to a logfile | |
) | while read line; do echo "microservice_one - $line"; done > logs/microservice_one.log | |
( | |
echo "Starting microservice_two..." | |
cd microservices/microservice_two | |
# Export all environment variables for this microservice | |
export PORT=7002 | |
export MICROSERVICE_TWO_ENV=true | |
export NODE_ENV=development | |
export RABBIT_MQ_URL=amqp://guest:guest@localhost:5672 | |
export MONGODB_URL=mongodb://localhost:27017/development | |
export REDIS_URL=redis://localhost | |
# start microservice | |
node_modules/.bin/nodemon src/server.js & | |
# redirect all output to a logfile | |
) | while read line; do echo "microservice_two - $line"; done > logs/microservice_two.log | |
echo "Press ctrl-C to exit" | |
while sleep 10000; do true; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment