diff --git a/.vscode/launch.json b/.vscode/launch.json index f5aeb77326..ec9e708874 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -16,7 +16,77 @@ ], "type": "pwa-node" }, - - + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/licensing", + "name": "Licensing: Debug with Docker", + "port": 9233, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/http-test-server", + "name": "HTTP Test Server: Debug with Docker", + "port": 9234, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/home", + "name": "Home: Debug with Docker", + "port": 9235, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/script-runnner", + "name": "Script Runner: Debug with Docker", + "port": 9236, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/init-script", + "name": "Init Script: Debug with Docker", + "port": 9237, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + }, + { + "address": "0.0.0.0", + "localRoot": "${workspaceFolder}/probe", + "name": "Probe: Debug with Docker", + "port": 9238, + "remoteRoot": "/usr/src/app", + "request": "attach", + "skipFiles": [ + "/**" + ], + "type": "pwa-node" + } ] } \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index cb611a911f..2e8e076518 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -1,5 +1,23 @@ version: '3.7' services: + ##IMPORTANT: + ## This container is an SMTP server used to send emails. + ## Setup private, tls_cert and tls_key keys before running this part + haraka: + ports: + - '2525:2525' + build: + context: ./haraka + args: + PORT: '2525' + environment: + - SMTP_USER=user@fyipe.com + - SMTP_PASSWORD=fyipe + - DOMAIN="${DOMAIN}" + - DKIM_PRIVATE_KEY="${DKIM_PRIVATE_KEY}" + - TLS_CERT="${TLS_CERT}" + - TLS_KEY="${TLS_KEY}" + mongo: image: mongo:4.2.3 ports: @@ -17,7 +35,7 @@ services: - SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=http://localhost:3002/api/user/sso/callback - SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp volumes: - - $PWD/saml/users.php:/var/www/simplesamlphp/config/authsources.php + - ./saml/users.php:/var/www/simplesamlphp/config/authsources.php redis: image: redis:5.0.7 @@ -35,6 +53,88 @@ services: - ./accounts/.env environment: - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./accounts:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + # There can only be one probe in developer docker compose. + probe1: + ports: + - '3024:3024' + - '9238:9229' # Debugging port. + build: + context: ./probe + dockerfile: ./Dockerfile.dev + env_file: + - ./probe/.env + environment: + - PORT=3024 + - SERVER_URL=http://backend:3002 + - PROBE_NAME=Probe 1 + - PROBE_KEY=test-key + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./probe:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + api-docs: + ports: + - '1445:1445' + build: + context: ./api-docs + dockerfile: ./Dockerfile.dev + env_file: + - ./api-docs/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./api-docs:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + init-script: + build: + context: ./init-script + dockerfile: ./Dockerfile.dev + ports: + - '1447:1447' + - '9237:9229' # Debugging port. + env_file: + - ./init-script/.env + environment: + - MONGO_URL=mongodb://mongo:27017/fyipedb + - REDIS_HOST=redis + - REDIS_PORT=6379 + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + - NODE_ENV=${NODE_ENV} + depends_on: + - mongo + - redis + volumes: + - ./init-script:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + script-runner: + ports: + - '3009:3009' + - '9236:9229' # Debugging port. + build: + context: ./script-runner + dockerfile: ./Dockerfile.dev + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./script-runner:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ backend: ports: @@ -61,24 +161,104 @@ services: # Exclude greenlock as well. - /usr/src/app/greenlock.d/ - # probe1: - # ports: - # - '3024:3024' - # build: - # context: ./probe - # dockerfile: ./Dockerfile.dev - # env_file: - # - ./probe/.env - # environment: - # - PORT=3024 - # - SERVER_URL=http://backend:3002 - # - PROBE_NAME=Probe 1 - # - PROBE_KEY=test-key - # - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} - # depends_on: - # - backend - # volumes: - # - $PWD/probe:/app + dashboard: + ports: + - '3000:3000' + build: + context: ./dashboard + dockerfile: ./Dockerfile.dev + env_file: + - ./dashboard/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./dashboard:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + home: + ports: + - '1444:1444' + - '9235:9229' # Debugging port. + env_file: + - ./home/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + build: + context: ./home + dockerfile: ./Dockerfile.dev + volumes: + - ./home:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + status-page: + ports: + - '3006:3006' + build: + context: ./status-page + dockerfile: ./Dockerfile.dev + env_file: + - ./status-page/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./status-page:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + admin-dashboard: + ports: + - '3100:3100' + build: + context: ./admin-dashboard + dockerfile: ./Dockerfile.dev + env_file: + - ./admin-dashboard/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + volumes: + - ./admin-dashboard:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + http-test-server: + ports: + - '3010:3010' + - '9234:9229' # Debugging port. + env_file: + - ./http-test-server/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + build: + context: ./http-test-server + dockerfile: ./Dockerfile.dev + volumes: + - ./http-test-server:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ + + licensing: + ports: + - '3004:3004' + - '9233:9229' # Debugging port. + env_file: + - ./licensing/.env + environment: + - IS_SAAS_SERVICE=${IS_SAAS_SERVICE} + build: + context: ./licensing + dockerfile: ./Dockerfile.dev + volumes: + - ./licensing:/usr/src/app + # Use node modules of the container and not host system. + # https://stackoverflow.com/questions/29181032/add-a-volume-to-docker-but-exclude-a-sub-folder + - /usr/src/app/node_modules/ volumes: mongodata: diff --git a/docker-compose.yml b/docker-compose.yml index 24f9d8d6ff..070eb741aa 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: - SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=http://localhost:3002/api/user/sso/callback - SIMPLESAMLPHP_SP_SINGLE_LOGOUT_SERVICE=http://localhost/simplesaml/module.php/saml/sp/saml2-logout.php/test-sp volumes: - - $PWD/saml/users.php:/var/www/simplesamlphp/config/authsources.php + - ./saml/users.php:/var/www/simplesamlphp/config/authsources.php redis: image: redis:5.0.7