summaryrefslogtreecommitdiff
path: root/docker-compose.yml
blob: ecd2fcebcb0fc3bbcf477d6d6ec3dfcf49b5485c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
version: "3.8"
services:
  frontend:
    build:
      context: ./frontend
      args:
        - REACT_APP_OAUTH_CLIENT_ID=${OPENDC_OAUTH_CLIENT_ID}
    image: frontend
    restart: on-failure
    ports:
      - "8081:80"
    networks:
      - backend

  api:
    build: ./api
    image: api
    restart: on-failure
    networks:
      - backend
    depends_on:
      - mongo
    environment:
      - MONGO_INITDB_ROOT_USERNAME
      - MONGO_INITDB_ROOT_PASSWORD
      - MONGO_INITDB_DATABASE
      - OPENDC_DB
      - OPENDC_DB_USERNAME
      - OPENDC_DB_PASSWORD
      - OPENDC_DB_HOST=mongo
      - OPENDC_FLASK_SECRET
      - OPENDC_OAUTH_CLIENT_ID
      - OPENDC_ROOT_DIR
      - OPENDC_SERVER_BASE_URL

  simulator:
    build: ./simulator
    image: simulator
    restart: on-failure
    networks:
      - backend
      - spark
    depends_on:
      - mongo
      - spark-master
      - spark-worker
    volumes:
      - type: bind
        source: ./traces
        target: /home/gradle/simulator/traces
      - type: volume
        source:  results-volume
        target: /results
    # Override to root as the simulator won't be able to access the volume otherwise
    user: root
    environment:
     - OPENDC_DB
     - OPENDC_DB_USERNAME
     - OPENDC_DB_PASSWORD
     - OPENDC_DB_HOST=mongo
     - OPENDC_OUTPUT=/results
     - OPENDC_SPARK=spark://spark-master:7077

  spark-master:
    image: docker.io/bitnami/spark:3-debian-10
    networks:
      - spark
    environment:
      - SPARK_MODE=master
      - SPARK_RPC_AUTHENTICATION_ENABLED=no
      - SPARK_RPC_ENCRYPTION_ENABLED=no
      - SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no
      - SPARK_SSL_ENABLED=no
    # Comment out for public deployment
    ports:
      - "8080:8080"
      - "7077:7077"

  spark-worker:
    image: docker.io/bitnami/spark:3-debian-10
    networks:
      - spark
    depends_on:
      - spark-master
    volumes:
      - type: volume
        source: results-volume
        target: /results
    environment:
      - SPARK_MODE=worker
      - SPARK_MASTER_URL=spark://spark-master:7077
      - SPARK_WORKER_MEMORY=2G
      - SPARK_WORKER_CORES=2
      - SPARK_RPC_AUTHENTICATION_ENABLED=no
      - SPARK_RPC_ENCRYPTION_ENABLED=no
      - SPARK_LOCAL_STORAGE_ENCRYPTION_ENABLED=no
      - SPARK_SSL_ENABLED=no
    ports:
    - "7081:8081"

  mongo:
    build:
      context: database
    restart: on-failure
    environment:
      - MONGO_INITDB_ROOT_USERNAME
      - MONGO_INITDB_ROOT_PASSWORD
      - MONGO_INITDB_DATABASE
      - OPENDC_DB
      - OPENDC_DB_USERNAME
      - OPENDC_DB_PASSWORD
    networks:
      - backend
    # Comment out for public deployment
    ports:
      - "27017:27017"
    # Uncomment for persistent deployment
    volumes:
      - mongo-volume:/data/db

  mongo-express:
    image: mongo-express
    restart: on-failure
    networks:
      - backend
    depends_on:
      - mongo
    ports:
      - 8082:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: "${MONGO_INITDB_ROOT_USERNAME}"
      ME_CONFIG_MONGODB_ADMINPASSWORD: "${MONGO_INITDB_ROOT_PASSWORD}"

volumes:
  mongo-volume:
    external: false
  results-volume:

networks:
  backend: {}
  spark: {}