Docker compose enhancement (#15)

* Pull some services from dockerhub

* Create build/deploy script

* Update deploy/README.md
This commit is contained in:
Patrick Rainier Juen
2019-10-07 06:45:16 +08:00
committed by Jack Murdock
parent 721a81b1f8
commit 111ba8de70
3 changed files with 47 additions and 76 deletions

View File

@@ -8,83 +8,28 @@ In order to deploy into Docker, make sure [Docker is installed](https://docs.doc
_note:_ While tr1d1um is not part of XMiDT(it is WebPA) it is recommend to be
brought up for current ease of use. Future releases will deprecate tr1d1um.
1. Have the services you want to bring up built (Talaria, Scytale, etc.).
1. Clone this repository
- Build the images locally
```bash
git clone git@github.com:Comcast/xmidt.git
git clone git@github.com:Comcast/talaria.git
git clone git@github.com:Comcast/scytale.git
git clone git@github.com:Comcast/petasos.git
git clone git@github.com:Comcast/caduceus.git
git clone git@github.com:Comcast/tr1d1um.git
2. Run `deploy/docker-compose/deploy.sh`
This will build `simulator` and `goaws` locally. It will then run `docker-compose up` which uses images of `talaria`, `scytale`, `petasos`, `caduceus`, and `tr1d1um` from dockerhub.
cd talaria
docker build -t talaria:local .
cd ..
To pull specific versions of the images, just set the `<SERVICE>_VERSION` env variables when running the shell script.
cd scytale
docker build -t scytale:local .
cd ..
```
TALARIA_VERSION=x.x.x deploy/docker-compose/deploy.sh
```
cd petasos
docker build -t petasos:local .
cd ..
If you only want to bring up, for example, the scytale and talaria, run:
_note_: bringup a subset can cause problems
```bash
deploy/docker-compose/deploy.sh scytale talaria
```
This can be done with any combination of services and the database.
cd caduceus
docker build -t caduceus:local .
cd ..
cd tr1d1um
docker build -t tr1d1um:local .
cd ..
cd xmidt/simulator
docker build -t simulator:local .
cd ../..
```
_note_: for building goaws:local since master breaks docker networking
```
git clone git@github.com:kcajmagic/goaws.git
cd goaws
git checkout adding_http_support
docker build -t goaws:local .
```
2. Set an environment variables relevant for the services you are deploying. If
you aren't using locally built images, replace `local` with the correct tag:
_note_ currently the images are not hosted anywhere
3. To bring the containers down:
```bash
export TALARIA_VERSION=local
export SCYTALE_VERSION=local
export CADUCEUS_VERSION=local
export PETASOS_VERSION=local
# This is the client code setup to run locally.
export SIMULATOR_VERSION=local
# This is WebPA not XMiDT
export TR1D1UM_VERSION=local
```
If you don't want to set environment variables, set them inline with each
`docker-compose` command below.
3. To bring the containers up run:
```bash
cd xmidt/deploy/docker-compose
docker-compose up -d
```
If you only want to bring up, for example, the scytale and talaria, run:
_note_: bringup a subset can cause problems
```bash
docker-compose up -d scytale talaria
```
This can be done with any combination of services and the database.
4. To bring the containers down:
```bash
docker-compose down
docker-compose -f deploy/docker-compose/docker-compose.yml down
```
### INFO

26
deploy/docker-compose/deploy.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
DIR=$( cd $(dirname $0) ; pwd -P )
ROOT_DIR=$DIR/../../
pushd $ROOT_DIR
echo "Building Simulator..."
docker build -t simulator:local $ROOT_DIR/simulator
popd
echo "Building goaws..."
git clone git@github.com:kcajmagic/goaws.git /tmp/goaws
pushd /tmp/goaws
git checkout adding_http_support
docker build -t goaws:local .
popd
echo "Running services..."
CADUCEUS_VERSION=${CADUCEUS_VERSION:-0.2.1} \
TR1D1UM_VERSION=${TR1D1UM_VERSION:-0.1.5} \
SCYTALE_VERSION=${SCYTALE_VERSION:-0.1.5} \
PETASOS_VERSION=${PETASOS_VERSION:-0.1.4} \
TALARIA_VERSION=${TALARIA_VERSION:-0.1.3} \
SIMULATOR_VERSION=${SIMULATOR_VERSION:-local} \
docker-compose -f deploy/docker-compose/docker-compose.yml up -d $@

View File

@@ -1,7 +1,7 @@
version: '3.4'
services:
caduceus:
image: caduceus:${CADUCEUS_VERSION}
image: xmidt/caduceus:${CADUCEUS_VERSION}
ports:
- 6000:6000
- 6001:6001
@@ -15,7 +15,7 @@ services:
- xmidt
tr1d1um:
image: tr1d1um:${TR1D1UM_VERSION}
image: xmidt/tr1d1um:${TR1D1UM_VERSION}
ports:
- 6100:6100
- 6101:6101
@@ -29,7 +29,7 @@ services:
- xmidt
scytale:
image: scytale:${SCYTALE_VERSION}
image: xmidt/scytale:${SCYTALE_VERSION}
ports:
- 6300:6300
- 6301:6301
@@ -68,7 +68,7 @@ services:
# Mark petasos Services
petasos: &petasos
image: petasos:${PETASOS_VERSION}
image: xmidt/petasos:${PETASOS_VERSION}
ports:
- 6400:6400
- 6401:6401
@@ -84,7 +84,7 @@ services:
# Mark Talaria Services
talaria-0: &talaria
image: talaria:${TALARIA_VERSION}
image: xmidt/talaria:${TALARIA_VERSION}
ports:
- 6200:6200
- 6201:6201