Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 500 after restart the container #34

Closed
fernandoneto opened this issue Jan 14, 2016 · 28 comments
Closed

Error 500 after restart the container #34

fernandoneto opened this issue Jan 14, 2016 · 28 comments

Comments

@fernandoneto
Copy link

If i restart the container of cachet when i try to access it im getting this error
captura de ecra de 2016-01-14 12 02 37

everything work just perfect before i restart.

@GrahamCampbell
Copy link
Contributor

Please show us the log file.

@fernandoneto
Copy link
Author

2016-01-14 11:57:46,230 INFO waiting for cron, nginx, php5-fpm to die
2016-01-14 11:57:46,240 INFO stopped: php5-fpm (exit status 0)
2016-01-14 11:57:46,244 INFO stopped: nginx (exit status 0)
2016-01-14 11:57:46,245 INFO stopped: cron (terminated by SIGTERM)
> rm -f compiled.php config.php routes.php services.json
Loading composer repositories with package information
Installing dependencies from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating optimized autoload files
> php artisan optimize --force
Generating optimized class loader
Compiling common classes
> php artisan config:cache
Configuration cache cleared!
Configuration cached successfully!
> php artisan route:cache
Route cache cleared!
Routes cached successfully!
> chmod -R 755 storage
Starting supervisord...
2016-01-14 11:58:07,215 CRIT Supervisor running as root (no user in config file)
2016-01-14 11:58:07,226 INFO RPC interface 'supervisor' initialized
2016-01-14 11:58:07,226 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2016-01-14 11:58:07,226 INFO supervisord started with pid 1
2016-01-14 11:58:08,229 INFO spawned: 'cron' with pid 75
2016-01-14 11:58:08,232 INFO spawned: 'nginx' with pid 76
2016-01-14 11:58:08,234 INFO spawned: 'php5-fpm' with pid 77
2016-01-14 11:58:09,278 INFO success: cron entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-01-14 11:58:09,278 INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-01-14 11:58:09,278 INFO success: php5-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2016-01-14 11:59:04,651 CRIT reaped unknown pid 104)
2016-01-14 12:00:04,888 CRIT reaped unknown pid 144)
2016-01-14 12:01:05,133 CRIT reaped unknown pid 165)
2016-01-14 12:02:05,364 CRIT reaped unknown pid 186)
2016-01-14 12:03:04,626 CRIT reaped unknown pid 199)
2016-01-14 12:04:04,894 CRIT reaped unknown pid 212)
2016-01-14 12:05:05,115 CRIT reaped unknown pid 225)
2016-01-14 12:06:05,354 CRIT reaped unknown pid 238)
2016-01-14 12:07:04,569 CRIT reaped unknown pid 251)
2016-01-14 12:08:04,797 CRIT reaped unknown pid 264)
2016-01-14 12:09:05,022 CRIT reaped unknown pid 299)
2016-01-14 12:10:05,252 CRIT reaped unknown pid 312)
2016-01-14 12:11:04,747 CRIT reaped unknown pid 325)
2016-01-14 12:12:04,983 CRIT reaped unknown pid 338)
2016-01-14 12:13:05,205 CRIT reaped unknown pid 351)

@jbrooksuk
Copy link
Member

@fernandoneto we're after the ./storage/logs file content please.

@fernandoneto
Copy link
Author

i create a gist

@GrahamCampbell
Copy link
Contributor

Looks like you forgot to configure the environment?

@GrahamCampbell
Copy link
Contributor

[2016-01-14 12:15:50] production.ERROR: exception 'RuntimeException' with message 'No supported encrypter found. The cipher and / or key length are invalid.' in /var/www/html/bootstrap/cache/compiled.php:7020
Stack trace:

@GrahamCampbell
Copy link
Contributor

That means no encryption key has been set.

@fernandoneto
Copy link
Author

@GrahamCampbell i fallow your documentation.
But after stop and start the container this problem appeared.

@fernandoneto
Copy link
Author

@GrahamCampbell i think i found the problem. in setup i select de cache-driver and session-driver as database. if i select APC(u) the container run without problems after restart.

can you tell me where I can find the documentation to try to better understand this part of the configuration.
I'm still a little confused about the first step of the configuration.
captura de ecra de 2016-01-14 14 43 18

@ibandak
Copy link

ibandak commented Apr 4, 2016

I'm running into the same problem. I have MySQL as the underlying database, and when choosing Database as the cache and sessions drivers during initial Setup, Cachet docker doesn't restart and gives 500 error, and gives error in laravel logs about the sessions and caches tables not existing in the DB. I did look in the DB and these tables don't exist. So I'm assuming that choosing Database doesn't really create the necessary tables in the DB and hence this fails on restart of docker container.

@jbrooksuk
Copy link
Member

@GrahamCampbell are we missing a migration?

@jadametz
Copy link

jadametz commented Apr 5, 2016

+1

After attempting to follow the instructions in Get started with Docker for both Docker and Docker Compose, I have been unable to successfully run Cachet.

Using just Docker I'm able to get Cachet and MySQL up and running (although MySQL doesn't do any provisioning of the cachet user -- this has to be manually done which clears the errors from Cachet@IP not being able to connect). However, the Cachet application is inaccessible from the browser.

Using Docker Compose I'm able to get the three containers running. However, after the initial setup, upon container restart the application is never accessible again.

Is there updated documentation on how to currently get the service up and running utilizing Docker or Docker Compose?

Ideally, I'd be able to author my own docker-compose.yml file in order to coordinate Cachet, MySQL, and appropriate volumes for each for use in production.

@jadametz
Copy link

jadametz commented Apr 5, 2016

@jbrooksuk perhaps to your point, after setting up via Docker Compose and restarting the containers, the logs contain an error from Postgres:

nginx_1    | 192.168.99.1 - - [05/Apr/2016:19:05:03 +0000] "GET /dashboard HTTP/1.1" 500 3169 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
postgres_1 | ERROR:  relation "sessions" does not exist at character 15
postgres_1 | STATEMENT:  select * from "sessions" where "id" = $1 limit 1

@djdefi
Copy link
Contributor

djdefi commented Apr 5, 2016

Not able to reproduce with current master branch, I just fixed #55 which may have been related.

@djdefi
Copy link
Contributor

djdefi commented Apr 5, 2016

Just re-pushed 2.2.0 tag and Docker hub build - Can you check and reproduce there?

@ibandak
Copy link

ibandak commented Apr 5, 2016

There are migrations missing for sure when using DB as the cache and sessions driver. After consulting the laravel documentation, I was able to get cachet working with a docker container restart by adding these commands after the app:install.

docker exec -it cachet php artisan session:table
docker exec -it cachet php artisan cache:table
docker exec -it cachet php artisan migrate

These commands will create the migrations for the missing caches and sessions tables in the DB.

Regards

@djdefi
Copy link
Contributor

djdefi commented Apr 5, 2016

Thanks for that info @ibandak - I had only tested with the APC(u) driver myself.

I don't know Laravel really so will need to defer to @jbrooksuk on those command.

@jadametz
Copy link

jadametz commented Apr 5, 2016

Okay, we seem to be making some progress. Here's where I'm at based on the latest information:

Note: commands in succession between two different terminals

docker-compose up
docker exec -i cachetdocker_cachet_1 php artisan key:generate
docker exec -i cachetdocker_cachet_1 php artisan app:install

Navigate to: http://192.168.99.100/setup

docker-compose stop
docker-compose up

Navigate to: http://192.168.99.100/setup

Able to complete setup and view empty dashboard.

docker-compose stop
docker-compose up

Navigate to: http://192.168.99.100/ -- successful rendering of timeline
Navigate to: http://192.168.99.100/dashboard -- successful rendering of Login

After login attempt:

Docker Compose logs:

nginx_1    | 192.168.99.1 - - [05/Apr/2016:20:48:18 +0000] "GET /auth/login HTTP/1.1" 200 15213 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
postgres_1 | ERROR:  relation "cache" does not exist at character 15
postgres_1 | STATEMENT:  select * from "cache" where "key" = $1 limit 1
nginx_1    | 192.168.99.1 - - [05/Apr/2016:20:48:26 +0000] "POST /auth/login HTTP/1.1" 500 3169 "http://192.168.99.100/auth/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"

@jadametz
Copy link

jadametz commented Apr 5, 2016

@ibandak using the information you provided, here's what I'm getting:

docker exec -i cachetdocker_cachet_1 php artisan session:table
 Migration created successfully!

docker exec -i cachetdocker_cachet_1 php artisan cache:table
 Migration created successfully!

docker exec -i cachetdocker_cachet_1 php artisan migrate
 **************************************
*     Application In Production!     *
**************************************

Command Cancelled!

Navigate to http://192.168.99.100/setup -- Error 500

docker-compose stop
docker-compose up

Navigate to http://192.168.99.100/setup -- Success -- complete setup with Database as cache and session driver

docker-compose stop
docker-compose up

Navigate to: http://192.168.99.100/ -- successful rendering of timeline
Navigate to: http://192.168.99.100/dashboard -- successful rendering of Login

After login attempt:
Same as above comment. 500 and Docker Compose logs reference "cache does not exist".

@ibandak
Copy link

ibandak commented Apr 5, 2016

@jadametz, why did you Cancel out of the prompt?

docker exec -it cachet php artisan migrate


  • Application In Production!     *
    

put "y" for yes and let it complete so it creates the tables, migrate will not destroy anything else it'll only create the 2 new tables..

@jadametz
Copy link

jadametz commented Apr 5, 2016

@ibandak the command wasn't cancelled by me.

It seems to be detecting that the .env file contains APP_ENV=production and is cancelling the migration as a result.

After some hackery I replaced the line in .env to be APP_ENV=development, restarted the containers and then was able to successfully run the migration:

Migrated: 2016_04_05_210500_create_sessions_table
Migrated: 2016_04_05_210505_create_cache_table

As a result, the service successfully persists through container restart.

@djdefi @jbrooksuk does this information help to find a more scalable solution to the issue?

@ibandak
Copy link

ibandak commented Apr 5, 2016

@jadametz , If you use the "--force" flag that will make it run without a prompt on production:
docker exec -it cachet php artisan migrate --force

@djdefi
Copy link
Contributor

djdefi commented Apr 8, 2016

Ran some tests around this on the latest version of master, please check out #58

@jadametz
Copy link

@djdefi looks like the changes you mentioned in #58 for initializing on initial "up", etc. all worked well. However, after restart of the containers I'm not able to login with the username provided during setup.

nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:24 +0000] "GET /dashboard HTTP/1.1" 302 384 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:24 +0000] "GET /auth/login HTTP/1.1" 200 15214 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:24 +0000] "GET /build/dist/css/all-5d444fe92b.css HTTP/1.1" 304 0 "http://192.168.99.100/auth/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:24 +0000] "GET /build/dist/js/all-84f6fb9f0b.js HTTP/1.1" 304 0 "http://192.168.99.100/auth/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:24 +0000] "GET /fonts/ionicons.ttf?v=2.0.0 HTTP/1.1" 304 0 "http://192.168.99.100/auth/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"
postgres_1 | ERROR:  relation "cache" does not exist at character 15
postgres_1 | STATEMENT:  select * from "cache" where "key" = $1 limit 1
nginx_1    | 192.168.99.1 - - [11/Apr/2016:20:13:27 +0000] "POST /auth/login HTTP/1.1" 500 3169 "http://192.168.99.100/auth/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36" "-"

@djdefi
Copy link
Contributor

djdefi commented Apr 11, 2016

Thanks for testing @jadametz - I was getting that same error using cache drivers other than APC(u) - I see above that you were using the "database" driver which I was not able to get working in my tests. Are you still using that driver?

I'm no laravel expert so not really sure what is missing from the Docker image for the other cache and session drivers to work...

@jadametz
Copy link

Yes, still using the database driver. To be honest, I'm not sure what these drivers are totally doing so if there's documentation somewhere that I'm missing, I'd love a link 😄

@djdefi
Copy link
Contributor

djdefi commented Apr 12, 2016

@jadametz https://docs.cachethq.io/docs/prerequisites is all I know of. That lists APCu and Redis (I have not tested Redis personally).

@djdefi
Copy link
Contributor

djdefi commented Apr 22, 2016

All defaults should be set now (see #63).

Please open a new issue if you are still having problems with the latest master.

@djdefi djdefi closed this as completed Apr 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants