Skip to content

Commit 6ee4185

Browse files
authored
Merge pull request #166 from atlanticwave-sdx/165.env-cleanup-round-two
Environment cleanup round two
2 parents 5968195 + c0d9bea commit 6ee4185

5 files changed

Lines changed: 69 additions & 50 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ jobs:
7979
SDX_VERSION: '1.0.0'
8080
SDX_NAME: 'sdx-controller-test'
8181
MQ_HOST: 'localhost'
82-
MQ_NAME: 'sdx-controller'
8382
SUB_QUEUE: 'sdx-controller-test-queue'
8483
DB_NAME: 'sdx-controllder-test-db'
8584
DB_CONFIG_TABLE_NAME: 'sdx-controller-test-table'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ venv/
109109
ENV/
110110
env.bak/
111111
venv.bak/
112+
env
112113

113114
# Spyder project settings
114115
.spyderproject

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Local controller sends domain information to SDX controller:
5555

5656
### Configuration
5757

58-
Copy the `env.template` to `.env`, and adjust it according to your
59-
environment.
58+
Copy the provided `env.template` file to `.env`, and adjust it
59+
according to your environment.
6060

6161
The communication between SDX controller and Local controller is
6262
enabled by RabbitMQ, which can either run on the same node as SDX
@@ -77,6 +77,7 @@ sdx-controller, bapm-server, and a MongoDB instance used by
7777
sdx-controller. From the project root directory, do:
7878

7979
```console
80+
$ source .env
8081
$ docker compose up --build
8182
```
8283

docker-compose.yml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,53 +4,55 @@ services:
44

55
# See https://hub.docker.com/_/mongo/ for documentation about
66
# MongoDB Docker images.
7-
sdx-controller-mongodb:
7+
mongodb-service:
88
image: mongo:3.7
9-
container_name: mongodb
109
environment:
11-
# MONGO_INITDB_DATABASE: test
12-
MONGO_INITDB_ROOT_USERNAME: guest
13-
MONGO_INITDB_ROOT_PASSWORD: guest
10+
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
11+
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
1412
MONGODB_DATA_DIR: /data/db
1513
volumes:
16-
# Named volumes. The 'Z' option tells Docker to label the
17-
# content with a private unshared label. Private volumes can
18-
# only be used by the current container. See
14+
# See https://docs.docker.com/storage/volumes/
15+
#
16+
# The 'Z' option tells Docker to label the content with a
17+
# private unshared label. Private volumes can only be used by
18+
# the current container. See
1919
# https://docs.docker.com/engine/reference/commandline/run/
20-
- ./db:/data/db:Z
20+
- type: volume
21+
source: mongodb
22+
target: /data/db:Z
2123

22-
sdx-controller:
24+
sdx-controller-service:
2325
image: sdx-controller
24-
container_name: sdx-controller
26+
depends_on:
27+
- mongodb-service
2528
tty: true
2629
build: ./
2730
ports:
2831
- 8080:8080
2932
environment:
30-
# Use sdx-controller-mongodb service specified above.
31-
- MONGODB_CONNSTRING=mongodb://guest:guest@sdx-controller-mongodb:27017/
32-
- SDX_HOST=aw-sdx-controller.renci.org
33-
- SDX_PORT=8080
34-
- SDX_VERSION=1.0.0
35-
- PUB_TOPIC=connection
36-
- SUB_QUEUE=sdx_q1
37-
- SUB_TOPIC=topo
38-
- SUB_QUEUE=topo
39-
- SUB_TOPIC=sdx_q1
40-
- MQ_HOST=aw-sdx-monitor.renci.org
41-
- DB_NAME=test-db
42-
- DB_CONFIG_TABLE_NAME=sdx-config-test-1
33+
# Use mongodb-service specified above. Note that we do not use
34+
# the same MONGODB_CONNSTRING variable from .env here, because
35+
# that is helpful for running unit/integration tests.
36+
- MONGODB_CONNSTRING=mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongodb-service:27017/
37+
- SDX_HOST=${SDX_HOST}
38+
- SDX_PORT=${SDX_PORT}
39+
- SDX_VERSION=${SDX_VERSION}
40+
- MQ_HOST=${MQ_HOST}
41+
- SUB_QUEUE=${SUB_QUEUE}
42+
- DB_NAME=${DB_NAME}
43+
- DB_CONFIG_TABLE_NAME=${DB_CONFIG_TABLE_NAME}
4344

44-
bapm-server:
45+
bapm-server-service:
4546
image: bapm-server
46-
container_name: bapm-server
47-
# network_mode: "host"
4847
tty: true
4948
build: ./bapm_server
5049
environment:
51-
- ES_HOST=localhost
52-
- ES_PORT=9200
53-
- BAPM_MQ_HOST=amqp://guest:guest@aw-sdx-monitor.renci.org:5672/%2F
54-
- BAPM_EXCHANGE=measurement
55-
- BAPM_QUEUE=sdx_q_measurement
56-
- BAPM_ROUTING_KEY=measurement.bapm
50+
- ES_HOST=${ES_HOST}
51+
- ES_PORT=${ES_PORT}
52+
- BAPM_MQ_HOST=${BAPM_MQ_HOST}
53+
- BAPM_EXCHANGE=${BAPM_EXCHANGE}
54+
- BAPM_QUEUE=${BAPM_QUEUE}
55+
- BAPM_ROUTING_KEY=${BAPM_ROUTING_KEY}
56+
57+
volumes:
58+
mongodb:

env.template

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
11
# SDX Controller settings.
2-
export SDX_HOST='localhost'
3-
export SDX_PORT='8080'
4-
export SDX_VERSION='1.0.0'
5-
export SDX_NAME='sdx-controller-test'
2+
export SDX_HOST="localhost"
3+
export SDX_PORT="8080"
4+
export SDX_VERSION="1.0.0"
5+
export SDX_NAME="sdx-controller-test"
66

7-
# Message queue settings.
8-
export MQ_HOST='localhost'
9-
export MQ_NAME='sdx-controller'
10-
export PUB_TOPIC='sdx-test-connection'
11-
export SUB_TOPIC='sdx-test-topology'
12-
export SUB_QUEUE='sdx-controller-test-queue'
7+
# Message queue settings for SDX Controller.
8+
export MQ_HOST="aw-sdx-monitor.renci.org"
9+
export SUB_QUEUE="topo"
1310

14-
# Database settings.
15-
export MONGODB_CONNSTRING='mongodb://guest:guest@localhost:27017/'
16-
export DB_NAME='sdx-controllder-test-db'
17-
export DB_CONFIG_TABLE_NAME='sdx-controller-test-table'
11+
# MongoDB settings for SDX Controller.
12+
export MONGO_INITDB_ROOT_USERNAME="guest"
13+
export MONGO_INITDB_ROOT_PASSWORD="guest"
14+
15+
# To run tests locally (with tox), localhost is convenient as
16+
# MONGO_HOST; for Docker Compose, we hard-code the container name in
17+
# the compose file.
18+
export MONGO_HOST="localhost"
19+
export MONGO_PORT="27017"
20+
export MONGODB_CONNSTRING="mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@${MONGO_HOST}:${MONGO_PORT}/"
21+
22+
export DB_NAME="sdx-controllder-test-db"
23+
export DB_CONFIG_TABLE_NAME="sdx-controller-test-table"
24+
25+
# Elastic Search for BAPM Server.
26+
export ES_HOST="localhost"
27+
export ES_PORT="9200"
28+
29+
# Message queue settings for BAPM Server.
30+
export BAPM_MQ_HOST="amqp://guest:guest@aw-sdx-monitor.renci.org:5672/%2F"
31+
export BAPM_EXCHANGE="measurement"
32+
export BAPM_QUEUE="sdx_q_measurement"
33+
export BAPM_ROUTING_KEY="measurement.bapm"

0 commit comments

Comments
 (0)