summaryrefslogtreecommitdiff
path: root/docker-compose.yml
blob: e0d57c88261a25ae2c9ab3bd907c4a805f9f8871 (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
##################################################################################################################
# Please put any variable changes for the environment or build arguments into the .env file of the source folder #
##################################################################################################################

version: '3.9'

services:

  maria_db:
    image: "mariadb:10.4.28"
    restart: always
    networks:
      - backend
    environment:
      MARIADB_DATABASE: demo
      MARIADB_USER: pse
      MARIADB_PASSWORD: PSEsq1702!mdb
      MARIADB_RANDOM_ROOT_PASSWORD: yes
    volumes:
      - database:/var/lib/mysql
    healthcheck:
      test: "/usr/bin/mysql --user=$${MARIADB_USER} --password=$${MARIADB_PASSWORD} --execute \"SHOW DATABASES;\""
      interval: 5s

  pse-backend:
    restart: always
    hostname: pse-backend
    network_mode: "bridge"
    build:
      context: ./pse-server
      dockerfile: Dockerfile
      args:
        SERVER_TIMEZONE: ${SERVER_TIMEZONE}
    networks:
      - backend
    environment:
      EMAIL_DASHBOARD_BASE_URL: http://${FRONTEND_DOMAIN}
      EMAIL_VERIFICATION_URL: http://${BACKEND_DOMAIN}/api/2/auth/%s/verify.json
      EMAIL_RESET_URL_PATH: /resetPassword
      SPRING_MAIL_HOST: ${SPRING_MAIL_HOST}
      SPRING_MAIL_PORT: ${SPRING_MAIL_PORT}
      SPRING_MAIL_USERNAME: ${SPRING_MAIL_USERNAME}
      SPRING_MAIL_PASSWORD: ${SPRING_MAIL_PASSWORD}
    depends_on:
      maria_db:
        condition: service_healthy
    links:
      - maria_db:maria_db

  pse-frontend:
    restart: always
    build:
      context: ./pse-dashboard
      dockerfile: Dockerfile
      args:
        VITE_BACKEND_URL: //${BACKEND_DOMAIN}
    networks:
      - frontend

  reverse-proxy:
    restart: always
    environment:
      NGINX_ENVSUBST_TEMPLATE_SUFFIX: ".tmpl"
      FRONTEND_DOMAIN: ${FRONTEND_DOMAIN}
      BACKEND_DOMAIN: ${BACKEND_DOMAIN}
    build:
      context: ./reverse-proxy
      dockerfile: Dockerfile
    networks:
      - frontend
      - backend
    depends_on:
      - pse-backend
      - pse-frontend
    # Uncomment volumes when using SSL (location of certificates)
    volumes:
      - ./reverse-proxy/letsencrypt:/letsencrypt
      - ./reverse-proxy/letsencrypt/certs:/etc/letsencrypt
    ports:
      - 80:80
      # Uncomment port when using SSL
      - 443:443 


  ######################################################################################
  # Uncomment following text to create / renew SSL certificates for Front- and Backend #
  ######################################################################################
  #
  # certbot:
  #   image: certbot/certbot
  #   container_name: certbot
  #   volumes: 
  #     - ./reverse-proxy/letsencrypt:/letsencrypt
  #     - ./reverse-proxy/letsencrypt/certs:/etc/letsencrypt
  #   command: certonly --webroot -w /letsencrypt -d ${FRONTEND_DOMAIN} -d ${BACKEND_DOMAIN} --email ${SPRING_MAIL_USERNAME} --agree-tos
  #   depends_on:
  #     - reverse-proxy

networks:
  frontend:
  backend:

volumes:
  database: