Docker icon indicating copy to clipboard operation
Docker copied to clipboard

Setup with existing postgres

Open lb-ovc opened this issue 1 year ago • 1 comments

Hello, i am trying to set up cachet with an existing postgres installation.

I did the following:

  • git clone https://github.com/cachethq/Docker.git cachet-docker
  • cd cachet-docker
  • nano docker-compose.yml:
version: "3"

services:
  # postgres:
  #   image: postgres:12-alpine
  #   volumes:
  #     - /var/lib/postgresql/data
  #   environment:
  #     - POSTGRES_USER=postgres
  #     - POSTGRES_PASSWORD=0q7QwkcLR7hhxvRYsz1ETaDhiD9hFZeEfPAeN71xSoKk34tdxx
  #     - POSTGRES_DATABASE=cachet
  #   restart: always
  cachet:
    build:
      context: .
      args:
        - cachet_ver=2.4
    ports:
      - 81:8000 
    # links:
    #   - postgres:postgres
    environment:
      - DB_DRIVER=pgsql
      - DB_HOST=/var/run/postgresql
      - DB_PORT=5432
      - DB_DATABASE=cachet  #created that db
      - DB_USERNAME=postgres
      - DB_PASSWORD=<postgres-user-password>
      - DB_PREFIX=chq_
      - APP_KEY=${APP_KEY:-null}
      - APP_LOG=errorlog
      - APP_ENV=${APP_ENV:-production}
      - APP_DEBUG=false
      - DEBUG=false
    restart: on-failure

I needed to change to another port as 80 is already exposed for a different service of us

  • docker compose build
  • docker compose up
[+] Running 1/0
 ✔ Container cachet-docker-cachet-1  Created                                                                                                                                                                                                                                                  0.0s 
Attaching to cachet-1
cachet-1  | Initializing Cachet container ...
cachet-1  | ERROR: Please set the 'APP_KEY=base64:xxx' environment variable at runtime or in docker-compose.yml and re-launch
cachet-1 exited with code 0
  • set the APP_KEY
  • docker compose build & docker compose up:
 ✔ Container cachet-docker-cachet-1  Recreated                                                                                                                                                                                                                                                0.1s 
Attaching to cachet-1
cachet-1  | Initializing Cachet container ...
cachet-1  | Attempting to connect to database ...
cachet-1  | ...........................................................
cachet-1  | Could not connect to database server! Aborting...
cachet-1 exited with code 0

lb-ovc avatar Oct 13 '24 22:10 lb-ovc

Found the Issue.. needed to set the ip of the server as the postgres host.

lb-ovc avatar Oct 13 '24 22:10 lb-ovc