Skip to content

Commit

Permalink
Replaced the network mode host with an internal network
Browse files Browse the repository at this point in the history
  • Loading branch information
hanak committed Mar 7, 2024
1 parent 0d9cba0 commit 3a0e966
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 62 deletions.
126 changes: 71 additions & 55 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ services:
build:
context: ./
dockerfile: docker/epicsBase/Dockerfile
networks:
- internal

node_cache:
image: node_cache
build:
context: ./
dockerfile: docker/node_cache/Dockerfile
networks:
- internal

frontendserverdev:
env_file: .env
build:
Expand All @@ -21,8 +27,8 @@ services:
- ./ReactApp/vite.config.js:/ReactApp/vite.config.js
- ./ReactApp/public:/ReactApp/public
restart: always
ports:
- "3001:3000"
networks:
- internal
depends_on:
- node_cache

Expand All @@ -31,20 +37,22 @@ services:
context: ./
dockerfile: docker/pvserver/Dockerfile
restart: always
network_mode: host
networks:
- internal
tty: true
stdin_open: true
env_file: .env
environment:
- ALARM_DATABASE=localhost
- ALARM_DATABASE=mongo1
- ALARM_DATABASE_REPLICA_SET_NAME=devrs
- LOADSAVE_DATABASE=localhost
- LOADSAVE_DATABASE=mongo1
- LOADSAVE_DATABASE_REPLICA_SET_NAME=devrs
- ADMIN_DATABASE=localhost
- ADMIN_DATABASE=mongo1
- ADMIN_DATABASE_REPLICA_SET_NAME=devrs
- WATCH_DEBUG_DATABASE=localhost
- WATCH_DEBUG_DATABASE=mongo1
- WATCH_DEBUG_DATABASE_REPLICA_SET_NAME=devrs
- DEMO_ARCHIVER=http://localhost:17668
- EPICS_CA_SERVER_PORT=8001
- pvServerLogLevel=INFO
- pvServerLogFile=/pvServer/log/pvServerLogFile
- pvServerPort=9001
Expand All @@ -54,39 +62,45 @@ services:
- ./build:/pvServer/build
depends_on:
- epicsbase

nginx:
image: nginx:1.25.3
restart: always
network_mode: host
networks:
- internal
depends_on:
- pvserver1
entrypoint:
- /custom/setupNginx.dev.sh
entrypoint:
- "/bin/bash"
- "-c"
- "source <(cat /custom/setupNginx.dev.sh | tr -d '\\r')"
- "--"
- /docker-entrypoint.sh
command: ["nginx", "-g", "daemon off;"]
command: ["nginx", "-g", "daemon off;"]
volumes:
- ./nginx/setupNginx.dev.sh:/custom/setupNginx.dev.sh
- ./nginx/nginx.dev.conf:/custom/nginx.dev.conf
- ./nginx/nginx.httpredirect.conf:/custom/nginx.httpredirect.conf
- ./nginx:/custom
- ./build/styleguide:/var/www/styleguide
- ./certificates:/etc/nginx/certificates
ports:
- "3000:3000"
env_file: .env

unsecurestylguidepvserver:
build:
context: ./

context: ./
dockerfile: docker/pvserver/Dockerfile
restart: always
network_mode: host
networks:
- internal
env_file: .env
environment:
- ALARM_DATABASE=localhost
- ALARM_DATABASE=mongo1
- ALARM_DATABASE_REPLICA_SET_NAME=devrs
- LOADSAVE_DATABASE=localhost
- LOADSAVE_DATABASE=mongo1
- LOADSAVE_DATABASE_REPLICA_SET_NAME=devrs
- ADMIN_DATABASE=localhost
- ADMIN_DATABASE=mongo1
- ADMIN_DATABASE_REPLICA_SET_NAME=devrs
- WATCH_DEBUG_DATABASE=localhost
- WATCH_DEBUG_DATABASE=mongo1
- WATCH_DEBUG_DATABASE_REPLICA_SET_NAME=devrs
- DEMO_ARCHIVER=http://localhost:17668
- pvServerURL=http://127.0.0.1
Expand All @@ -99,15 +113,16 @@ services:

demoioc:
build:
context: ./

context: ./
dockerfile: docker/demoioc/Dockerfile
tty: true
stdin_open: true
restart: always
network_mode: host
networks:
- internal
depends_on:
- epicsbase

storybook:
build:
context: ./
Expand All @@ -121,15 +136,14 @@ services:
depends_on:
- node_cache



signalcli:
build:
context: ./
dockerfile: docker/signalcli/Dockerfile
hostname: signalcli
restart: always
network_mode: "host"
networks:
- internal
stdin_open: true
tty: true
env_file: .env
Expand All @@ -142,7 +156,8 @@ services:
dockerfile: docker/alarmHandlerDbInit/Dockerfile
hostname: initializealarmhandlerdb
restart: on-failure
network_mode: "host"
networks:
- internal
depends_on:
- mongosetup
stdin_open: true
Expand All @@ -158,7 +173,8 @@ services:
depends_on:
- epicsbase
- initializealarmhandlerdb
network_mode: "host"
networks:
- internal
stdin_open: true
tty: true
env_file: .env
Expand All @@ -176,11 +192,9 @@ services:
image: mongo:${RAS_MONGODB_VERSION-7.0.5}
hostname: mongo1
restart: always
network_mode: "host"
networks:
- internal
env_file: .env
# environment:
# MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME-admin}
# MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD-password}
logging:
driver: "none"
volumes:
Expand All @@ -192,11 +206,9 @@ services:
image: mongo:${RAS_MONGODB_VERSION-7.0.5}
hostname: mongo2
restart: always
network_mode: "host"
networks:
- internal
env_file: .env
# environment:
# MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME-admin}
# MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD-password}
logging:
driver: "none"
volumes:
Expand All @@ -208,11 +220,9 @@ services:
image: mongo:${RAS_MONGODB_VERSION-7.0.5}
hostname: mongo3
restart: always
network_mode: "host"
networks:
- internal
env_file: .env
# environment:
# MONGO_INITDB_ROOT_USERNAME: ${MONGO_ROOT_USERNAME-admin}
# MONGO_INITDB_ROOT_PASSWORD: ${MONGO_ROOT_PASSWORD-password}
logging:
driver: "none"
volumes:
Expand All @@ -226,7 +236,8 @@ services:
dockerfile: docker/mongoSetup/Dockerfile
hostname: mongosetup
restart: on-failure
network_mode: "host"
networks:
- internal
depends_on:
- mongo1
- mongo2
Expand All @@ -238,41 +249,41 @@ services:
initializeloadsavedb:
env_file: .env
environment:
- LOADSAVE_DATABASE=localhost
- LOADSAVE_DATABASE=mongo1
- LOADSAVE_DATABASE_REPLICA_SET_NAME=devrs
build:
context: ./


dockerfile: docker/loadSaveDbInit/Dockerfile
network_mode: "host"
networks:
- internal
tty: true
stdin_open: true
depends_on:
- mongosetup

initializeadmindb:
env_file: .env
environment:
- ADMIN_DATABASE=localhost
- ADMIN_DATABASE=mongo1
- ADMIN_DATABASE_REPLICA_SET_NAME=devrs
build:
context: ./


context: ./
dockerfile: docker/adminDbInit/Dockerfile
network_mode: "host"
networks:
- internal
tty: true
stdin_open: true
depends_on:
- mongosetup

areadetectorsim:
image: prjemian/synapps
ports:
- "8005:8005/tcp" #areaDetector IOC is served on port 8005 so as not to conflict with other instances on the network, use the port number to access the IOC from other GUIS
- "8005:8005/udp"
hostname: areadetectorsim
networks:
- internal
environment:
- PREFIX="ras:adsim:" # OPI macro: P = ras:adsim: , R = cam1:
- EPICS_CA_SERVER_PORT=8005
- EPICS_CA_SERVER_PORT=8001
command: bash -c "/root/bin/adsim.sh start && tail -f /dev/null"

# As of RAS V5.0.0 MongoDB volumes are now defined by the compose project name and mongodb version
Expand All @@ -293,3 +304,8 @@ volumes:
name: ${COMPOSE_PROJECT_NAME}-mongo-db-data3-mongo-${RAS_MONGODB_VERSION-7.0.5}
mongo-db-configdb3:
name: ${COMPOSE_PROJECT_NAME}-mongo-db-configdb3-mongo-${RAS_MONGODB_VERSION-7.0.5}

networks:
internal:
name: ${COMPOSE_PROJECT_NAME}_internal
driver: bridge
1 change: 0 additions & 1 deletion docker/pvserver/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ ENV VITE_EnableLogin=false
ENV VITE_DisableStandardLogin=false
ENV VITE_EnableActiveDirectoryLogin=false
ENV VITE_EnableGoogleLogin=false
ENV EPICS_CA_ADDR_LIST="0.0.0.0:8001 0.0.0.0:8004 0.0.0.0:8005"
ENV PYEPICS_LIBCA=/epics/base/lib/linux-x86_64/libca.so

ENV PATH="/epics/base/bin/linux-x86_64/:${PATH}"
Expand Down
11 changes: 5 additions & 6 deletions nginx/nginx.dev.conf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

upstream servers {
server 127.0.0.1:9001;
server pvserver1:9001;
}

server {
listen $listen;
#insert ssl_certificate def here;
#insert ssl_certificate_key def here;
location / {
proxy_pass http://127.0.0.1:3001;
proxy_pass http://frontendserverdev:3000;
proxy_connect_timeout 300;
proxy_send_timeout 300;
proxy_read_timeout 300;
Expand All @@ -22,7 +22,7 @@ server {
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:3001;
proxy_pass http://frontendserverdev:3000;
}
location /socket.io {
proxy_http_version 1.1;
Expand All @@ -36,15 +36,14 @@ server {
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:3001;
proxy_pass http://frontendserverdev:3000;
}
error_page 497 https://$host:3000$request_uri;

}

upstream styleguideservers {
server 127.0.0.1:5001;

server unsecurestylguidepvserver:5001;
}

server {
Expand Down

0 comments on commit 3a0e966

Please sign in to comment.