cachethq / Docker

A Dockerized version of Cachet.
https://cachethq.io
BSD 3-Clause "New" or "Revised" License
416 stars 280 forks source link

Can't generate app key as docker closes cachet container due to missing app key #375

Open tomck opened 4 years ago

tomck commented 4 years ago
cachet_1    | ERROR: Please set the 'APP_KEY=base64:0jboLlfNau8ejNCizAXBKIa1mHPCRTPpfC70gzFO3sg=' environment variable at runtime or in docker-compose.yml and re-launch
cachet-docker_cachet_1 exited with code 0

Environment: Amazon Linux AMI release 2018.03 Docker version 19.03.6-ce, build 369ce74 docker-compose version 1.25.5, build 8a1c60f6 git version 2.14.5

sudo docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
cachet-docker_cachet   latest              e33e727f75c6        4 minutes ago       376MB
postgres               12-alpine           ae192c4d3ada        2 weeks ago         152MB
nginx                  1.17.8-alpine       48c8a7c47625        3 months ago        21.8MB

Steps to reproduce: Launch AWS free instance with ami-097834fcb3081f51a

yum install git docker -y
git clone https://github.com/cachethq/Docker.git cachet-docker
cd cachet-docker/
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo service docker start
sudo /usr/local/bin/docker-compose build
sudo /usr/local/bin/docker-compose up

I tried doing the normal install but kept getting stuck in random laravel issues and thought just using the Docker would be simpler.

ppinzon commented 4 years ago

In the docker-compose.yml file theres an environment variable called APP_KEY which by default is set to null. Replace "null" with whatever key cachet generated for you. In your case it would end up looking like this:

APP_KEY=${APP_KEY:-base64:0jboLlfNau8ejNCizAXBKIa1mHPCRTPpfC70gzFO3sg=}

rossigee commented 4 years ago

If your database is not yet initialised, I think you can just generate your own key?

head -c32 /dev/urandom | base64

tomck commented 4 years ago

What @ppinzon said helped, that got me up and running. I will note that the reason for this issue is the resolution you're proposing conflicts with step 6 of the quickstart in the README.md. https://github.com/CachetHQ/Docker/commit/e9ddbfebcc67b9753edad2ed512ea3cd38e0a49c