Skip to content

Setup with existing postgres #431

@lb-ovc

Description

@lb-ovc

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

I did the following:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions