nabekhan commented on issue #1206:
URL: https://github.com/apache/answer/issues/1206#issuecomment-2585627957

   A more permanent solution I found to prevent 50x errors on redeployment is 
to add a healthcheck to your docker-compose to ensure the database is loaded 
first, as described in #472. Here is mine:
   
   ```
   services:
     answer:
       image: apache/answer:latest
       container_name: answer
       ports:
         - "9080:80"
       volumes:
         - root_answer-data:/data
       environment:
         DB_TYPE: mysql
         DB_HOST: db:3306
         DB_USERNAME: answer_user
         DB_PASSWORD: strong_password
         DB_NAME: answer_db
         AUTO_INSTALL: true
         ADMIN_EMAIL: [email protected]
         ADMIN_NAME: cmsait
         ADMIN_PASSWORD: strong_password
         CONTACT_EMAIL: [email protected]
         LANGUAGE: en-US
         SITE_NAME: Answers
         SITE_URL: https://answer.msa.com
       depends_on:
         db:
           condition: service_healthy
       restart: always
   
     db:
       image: mysql:latest
       container_name: mysql
       environment:
         MYSQL_ROOT_PASSWORD: strong_password
         MYSQL_DATABASE: answer_db
         MYSQL_USER: answer_user
         MYSQL_PASSWORD: strong_password
       healthcheck:
         test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-uroot", 
"-pstrong_password"]
         timeout: 20s
         retries: 10
       volumes:
         - root_db-data:/var/lib/mysql
       restart: always
   
   volumes:
     root_answer-data:
       external: true
     root_db-data:
       external: true
   ``` 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to