Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compose multiple service like docker-compose without docker
#!/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
You can’t perform that action at this time.