Docker icon indicating copy to clipboard operation
Docker copied to clipboard

Docker-compose tutorial updates?

Open esseti opened this issue 3 years ago • 2 comments

I'm trying to test out Cachet with docker-compose following this link: https://docs.cachethq.io/docs/get-started-with-docker

so far:

  • last version of cachet (2.3.18) not working since the command called :install does not exists
  • using the version as is in the guide i get this error
cachet_1    | Initializing Cachet database ...
postgres_1  | 2022-05-04 14:46:20.192 UTC [62] ERROR:  relation "chq_settings" does not exist at character 29
postgres_1  | 2022-05-04 14:46:20.192 UTC [62] STATEMENT:  select "name", "value" from "chq_settings"
cachet_1    | PHP Fatal error:  Uncaught ErrorException: count(): Parameter must be an array or an object that implements Countable in /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php:51
cachet_1    | Stack trace:
cachet_1    | #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'count(): Parame...', '/var/www/html/v...', 51, Array)
cachet_1    | #1 /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php(51): count(NULL)
cachet_1    | #2 /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionHandlerTrait.php(47): GrahamCampbell\Exceptions\ExceptionIdentifier->identify(Object(ErrorException))
cachet_1    | #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): GrahamCampbell\Exceptions\ExceptionHandler->report(Object(ErrorException))
cachet_1    | #4 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(ErrorException))
cachet_1    | #5 {main}
cachet_1    |   thrown in /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php on line 51
cachet_1    | PHP Fatal error:  Uncaught ErrorException: count(): Parameter must be an array or an object that implements Countable in /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php:51
cachet_1    | Stack trace:
cachet_1    | #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'count(): Parame...', '/var/www/html/v...', 51, Array)
cachet_1    | #1 /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php(51): count(NULL)
cachet_1    | #2 /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionHandlerTrait.php(47): GrahamCampbell\Exceptions\ExceptionIdentifier->identify(Object(Symfony\Component\Debug\Exception\FatalErrorException))
cachet_1    | #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(79): GrahamCampbell\Exceptions\ExceptionHandler->report(Object(Symfony\Component\Debug\Exception\FatalErrorException))
cachet_1    | #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(118): Illuminate\Foundation\Bootstrap\HandleExceptions->handleExcep in /var/www/html/vendor/graham-campbell/exceptions/src/ExceptionIdentifier.php on line 51
cachet-docker_cachet_1 exited with code 255

anyone that has an update guide for deploying cachet? is the project mantained?

esseti avatar May 04 '22 14:05 esseti

Problem:

  • what's the setup correct to avoid re-doing all the setup everytime i do a docker-compose down/up? it restart from begining everytime
  • i've found no solution to send email. it seems that env values are not stored/read when trying to setup the email.

esseti avatar May 05 '22 08:05 esseti

I was able to make it start and work. docker-compose for postgres + cachet OS bgubx and certbot for serving and https

docker-compose.yml

(fix missing data or remove stuff)

version: "3"

services:
  postgres:
    image: postgres:12-alpine
    volumes:
      - dbdata:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
    restart: always
  cachet:
    image: cachethq/docker:latest
    ports:
      - 8000:8000
    links:
      - postgres:postgres
    environment:
      - DB_DRIVER=pgsql
      - DB_HOST=postgres
      - DB_PORT=5432
      - DB_DATABASE=postgres
      - DB_USERNAME=postgres
      - DB_PASSWORD=postgres
      - DB_PREFIX=chq_
      - APP_LOG=errorlog
      - APP_ENV=${APP_ENV:-production}
      - APP_DEBUG=false
      - DEBUG=false
      - APP_KEY=<YOURKEY>
      # this is the domain
      - MAIL_USERNAME=<DOMAIN IN MAILGUN>
      - MAIL_DRIVER=mailgun
      - MAIL_HOST=smtp.mailgun.org
      - MAIL_PORT=587
      # this is the api Key
      - MAIL_PASSWORD=<APIKEY>
      - MAIL_ADDRESS=<EMAIL ADDRESS>
      - MAIL_ENCRYPTION=tls

    depends_on:
      - postgres
    restart: on-failure

# persistent storage
volumes:
  dbdata:

with this you have the system exposed to localhost:8000

cachet.conf (put in /sites-enabled)

server {
  listen 80;
  # the servername
  server_name <YOUR DOMAIN>;
  location / {
    proxy_pass http://localhost:8000/;
    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;
  }
}

with this you have it exposed to :80

for SSL use certbot (https://certbot.eff.org/ -> select nginx and your operating system for instruction)

esseti avatar May 05 '22 14:05 esseti