H2-invent / open-datenschutzcenter

Open Source Datenschutzmanagement System
https://open-datenschutzcenter.de
GNU Affero General Public License v3.0
36 stars 10 forks source link

How to install ODC when traefik exist in other container #229

Closed Mazen-Saab closed 11 months ago

Mazen-Saab commented 11 months ago

I tried to change docker-compose.yml but it does not work probably.

version: '3.8'

x-app-common: &odc_app build: . environment: APACHE_DOCUMENT_ROOT: "public/" PHP_EXTENSION_XDEBUG: "1" PHP_INI_MEMORY_LIMIT: "1G" PHP_EXTENSION_LDAP: 1 PHP_EXTENSION_INTL: 1 MAILER_DSN: ${MAILER_DSN}

services:

Here is the ODC app

app-odc: <<: *odc_app depends_on: db-odc: condition: service_healthy healthcheck: test: [ "CMD", "curl", "-s", "-f", "-i", "http://localhost:80/health/check" ] interval: 20s timeout: 10s start_period: 30s retries: 10

environment:
  APACHE_DOCUMENT_ROOT: "public/"
  PHP_EXTENSION_XDEBUG: "1"
  PHP_INI_MEMORY_LIMIT: "1G"
  PHP_EXTENSION_LDAP: 1
  PHP_EXTENSION_INTL: 1
  DATABASE_URL: mysql://odc:${ODC_DB_PW}@${RANDOMTAG}db-odc:3306/odc
  MAILER_TRANSPORT: smtp
  OAUTH_KEYCLOAK_CLIENT_ID: opendatenschutzcenter
  OAUTH_KEYCLOAK_CLIENT_SECRET: ${OAUTH_KEYCLOAK_CLIENT_SECRET}
  OAUTH_KEYCLOAK_SERVER: ${HTTP_METHOD}://keycloak-${PUBLIC_URL}/auth
  OAUTH_KEYCLOAK_REALM: opendatenschutzcenter
  MAILER_DSN: ${MAILER_DSN}
  MAILER_HOST: ${MAILER_HOST}
  MAILER_PORT: ${MAILER_PORT}
  MAILER_PASSWORD: ${MAILER_PASSWORD}
  MAILER_USERNAME: ${MAILER_USERNAME}
  MAILER_ENCRYPTION: ${MAILER_ENC}
  laF_version: ${GIT_VERSION}
  registerEmailAdress: ${registerEmailAdress}
  laF_baseUrl: ${HTTP_METHOD}://${PUBLIC_URL}
  VICH_BASE: ${HTTP_METHOD}://${PUBLIC_URL}
  CRON_USER_1: root
  CRON_SCHEDULE_1: "* * * * *"
  CRON_COMMAND_1: "php /var/www/html/bin/console cron:run"

labels:
  - "traefik.enable=true"
  - "traefik.http.routers.app-odc.tls=true"
  - "traefik.http.routers.app-odc.rule=Host(`${PUBLIC_URL}`)"
  - "traefik.http.routers.app-odc.entrypoints=web-secure"
  - "traefik.http.services.app-odc.loadbalancer.server.port=80"
  - "traefik.http.routers.app-odc.tls.certresolver=myresolver"
  - "traefik.http.services.app-odc.loadbalancer.sticky=true"
  - "traefik.http.services.app-odc.loadbalancer.sticky.cookie.name=odc"
  - "traefik.http.services.app-odc.loadbalancer.sticky.cookie.secure=true"
volumes:
  - datenschutzcenter_uploads:/var/www/html/public/uploads:rw
  - datenschutzcenter_secret_storage:/var/www/html/secretStorage:rw
  - datenschutzcenter_data:/var/www/html/public/data:rw
  - $PWD/dockerupdate.sh:/etc/container/startup.sh
  - $PWD/dockerupdate.sh:/temp/container/startup.sh

db-odc: image: mariadb:latest hostname: ${RANDOMTAG}db-odc healthcheck: test: [ "CMD", "mariadb-admin" ,"ping", "-h", "localhost","-ptest" ] timeout: 20s retries: 10 environment: MARIADB_ROOT_PASSWORD: test volumes:

volumes: mariadb: image_upload: datenschutzcenter_uploads: datenschutzcenter_data: datenschutzcenter_secret_storage:

holema commented 11 months ago

What is the exact error you are facing?

Mazen-Saab commented 11 months ago

Server connot up ..! app-odc I have this error also in log first: time="2023-11-15T13:15:59+01:00" level=info msg="read crontab" /tmp/generated_crontab" sudo: /etc/container/startup.sh: command not found .

holema commented 11 months ago

do you start the docker compose with the script or joust with docker-compose up?

Mazen-Saab commented 11 months ago

installDockerUbuntu.sh and installOdcDocker.sh

holema commented 11 months ago

okay, then normaly the permissions for the startup script should be set correctly. Why is this line here doubled?

  - $PWD/dockerupdate.sh:/etc/container/startup.sh
  - $PWD/dockerupdate.sh:/temp/container/startup.sh

in the original there is only: - $PWD/dockerupdate.sh:/etc/container/startup.sh

Mazen-Saab commented 11 months ago

It doesn't work. I did that, now it starts

error Log: time="2023-11-15T14:32:00+01:00" level=error msg="error running command: exit status 1" iteration=16 job.command="sudo -E -u root -- bash -c 'php /var/www/html/bin/console cron:run'" job.position=0 job.schedule=" *"

from browser:
https://odc.xxxx --> Gateway Timeout https://keycloak-odc.xxx --> Gateway Timeout

holema commented 11 months ago

Hello @Mazen-Saab,

it is very hard to make a diagnose without knowing your setup and the configuration of your treafikbut I try my best. Could it be that the trafik and the service containers are not in the same docker network? This is necessary when you use a seperate traefik to register correctly.

Mazen-Saab commented 11 months ago

thank you very much that was.....! traefik was in one Network I add the ODC Network to traefik... it works :)

thank you very much :)