diff --git a/dockercompose/docker-compose.yml b/dockercompose/docker-compose.yml index e7deb7f..4fe1fbc 100644 --- a/dockercompose/docker-compose.yml +++ b/dockercompose/docker-compose.yml @@ -66,14 +66,22 @@ services: retries: 5 networks: - app-network + etherpad: - image: etherpad/etherpad + image: etherpad/etherpad:1.9.7 ports: - "9001:9001" volumes: - ../doodlestudent/api/APIKEY.txt:/opt/etherpad-lite/APIKEY.txt networks: - app-network + healthcheck: + test: ["CMD-SHELL", "node -e \"require('http').get('http://127.0.0.1:9001', res => { process.exit(res.statusCode===200?0:1) }).on('error', ()=>process.exit(1))\""] + interval: 30s + timeout: 10s + start_period: 15s + retries: 5 + mail: image: bytemark/smtp restart: always @@ -82,7 +90,7 @@ services: networks: - app-network -networks: - app-network: - #external: false - name: app-network \ No newline at end of file +networks: # Declare the network to be used by the services + app-network: # Is a user-defined network + #external: false # If true, Docker Compose will look for an existing network with the same name and use it. If false or not specified, Docker Compose will create a new network. + name: app-network #Name of the network (optional, Docker Compose will generate one if not provided) \ No newline at end of file diff --git a/dockerfiles/back/DockerfileUsingApiNative b/dockerfiles/back/DockerfileUsingApiNative index 3ec6c40..3e632d8 100644 --- a/dockerfiles/back/DockerfileUsingApiNative +++ b/dockerfiles/back/DockerfileUsingApiNative @@ -29,10 +29,12 @@ RUN chown 1001 /work \ EXPOSE 8080 USER 1001 -#ENV quarkus_datasource_jdbc_url "jdbc:mysql://db:3306/tlc?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true&serverTimezone=Europe/Paris" ENV quarkus_datasource_jdbc_url "jdbc:mysql://db:3306/tlc?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&createDatabaseIfNotExist=true&serverTimezone=Europe/Paris" ENV quarkus_datasource_username tlc ENV quarkus_datasource_password tlc ENV QUARKUS_HIBERNATE_ORM_DATABASE_GENERATION update - +ENV doodle_internalPadUrl "http://etherpad:9001/" +ENV doodle_externalPadUrl "http://etherpad:9001/" +ENV mailer_host mail +ENV mailer_port 25 CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/dockerfiles/front/nginx.conf b/dockerfiles/front/nginx.conf deleted file mode 100644 index f599a1e..0000000 --- a/dockerfiles/front/nginx.conf +++ /dev/null @@ -1,33 +0,0 @@ -server { - listen 80; - server_name _; - - root /usr/share/nginx/html; - index index.html; - - # Proxy /api and all subpaths to backend service (back container on port 8080) - location /api/ { - proxy_pass http://back:8080/api/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_http_version 1.1; - proxy_set_header Connection ""; - } - - # Also handle /api without trailing slash - location = /api { - proxy_pass http://back:8080/api; - } - - # SPA fallback for client-side routing - location / { - try_files $uri $uri/ /index.html; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} \ No newline at end of file diff --git a/dockerfiles/nginx/Dockerfile b/dockerfiles/nginx/Dockerfile index e6c472b..3ddb6a3 100644 --- a/dockerfiles/nginx/Dockerfile +++ b/dockerfiles/nginx/Dockerfile @@ -1,6 +1,6 @@ FROM nginx:latest -COPY nginxFront.conf /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf COPY index.html /usr/share/nginx/html/ diff --git a/dockerfiles/nginx/nginx.conf b/dockerfiles/nginx/nginx.conf deleted file mode 100644 index 95a0fe6..0000000 --- a/dockerfiles/nginx/nginx.conf +++ /dev/null @@ -1,75 +0,0 @@ -########################## -## FRONTEND + API -########################## -server { - listen 80; - listen [::]:80; - server_name _; - - root /usr/share/nginx/html; - index index.html; - - ########################## - # Proxy API requests to the back service - ########################## - location /api/polls { - proxy_pass http://back:8080/; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Connection ""; - } - ########################## - # FrontEnd returns - ########################## - location / { - proxy_pass http://front:5080; - proxy_http_version 1.1; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Connection ""; - } - - error_page 500 502 503 504 /50x.html; - location = /50x.html { - root /usr/share/nginx/html; - } -} - -## -## BACKEND -## -server { - listen 80; - listen [::]:80; - server_name _; - - location / { - proxy_pass http://back:8080; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - } -} - -## -## ETHERPAD -## -server { - listen 80; - listen [::]:80; - server_name _; - - location / { - proxy_pass http://etherpad:9001; - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $remote_addr; - } -} diff --git a/nginx.conf b/nginx.conf index dc4c1b1..3b2d465 100644 --- a/nginx.conf +++ b/nginx.conf @@ -31,8 +31,8 @@ server { ########################## # Proxy API requests to the back service ########################## - location /api/polls { - proxy_pass http://back:8080/; + location /api/ { + proxy_pass http://back:8080; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr;