jackbrycesmith / laravel-caprover-template

Template to deploy a Laravel app in docker for CapRover
MIT License
126 stars 42 forks source link

Successful build but cannot access the website #20

Closed sandoche closed 2 years ago

sandoche commented 2 years ago

Hi,

When I try to access the website I have the caprover error page: Your app will be here! Go ahead and deploy your app now!

Even though the build seems successful. Do you know what am I doing wrong?

Image log

Successfully built 783959e75684
Successfully tagged img-captain-retape-website:latest
Build has finished successfully!

App Logs

2022-02-04T15:43:56.791073774Z 🎬 start supervisord
2022-02-04T15:43:56.858764905Z {"level":"info","ts":1643989436.8584933,"msg":"using provided configuration","config_file":"/srv/app/.deploy/config/Caddyfile","config_adapter":""}
2022-02-04T15:43:56.862924897Z {"level":"info","ts":1643989436.8627582,"logger":"admin","msg":"admin endpoint started","address":"tcp/localhost:2019","enforce_origin":false,"origins":["localhost:2019","[::1]:2019","127.0.0.1:2019"]}
2022-02-04T15:43:56.863423937Z {"level":"info","ts":1643989436.8633134,"logger":"http","msg":"server is listening only on the HTTP port, so no automatic HTTPS will be applied to this server","server_name":"srv0","http_port":80}
2022-02-04T15:43:56.864293164Z {"level":"info","ts":1643989436.8641803,"msg":"autosaved config","file":"/home/app/.config/caddy/autosave.json"}
2022-02-04T15:43:56.864447628Z {"level":"info","ts":1643989436.8643646,"msg":"serving initial configuration"}
2022-02-04T15:43:56.864775726Z {"level":"info","ts":1643989436.8646352,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc0002d6690"}
2022-02-04T15:43:56.864976712Z {"level":"info","ts":1643989436.864896,"logger":"tls","msg":"cleaned up storage units"}
2022-02-04T15:43:56.874034662Z [04-Feb-2022 15:43:56] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
2022-02-04T15:43:56.874094571Z [04-Feb-2022 15:43:56] NOTICE: [pool www] 'user' directive is ignored when FPM is not running as root
2022-02-04T15:43:56.874100317Z [04-Feb-2022 15:43:56] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
2022-02-04T15:43:56.874104425Z [04-Feb-2022 15:43:56] NOTICE: [pool www] 'group' directive is ignored when FPM is not running as root
2022-02-04T15:43:56.874228893Z [04-Feb-2022 15:43:56] NOTICE: fpm is running, pid 33
2022-02-04T15:43:56.874939757Z [04-Feb-2022 15:43:56] NOTICE: ready to handle connections
2022-02-04T15:44:01.661711459Z No scheduled commands are ready to run.
2022-02-04T15:44:02.048032599Z No scheduled commands are ready to run.
2022-02-04T15:45:01.275758066Z No scheduled commands are ready to run.
2022-02-04T15:45:12.326628613Z 127.0.0.1 -  04/Feb/2022:15:45:11 +0000 "GET /index.php" 200
jackbrycesmith commented 2 years ago

Hmm have you been able to run any other apps on the server? If not try a lightweight one-click-app just to see if its routing correctly. You could also try a hard reboot of the server to see if that helps.

Everything looks good from app logs, with the last line suggesting its handling the request fine...

sandoche commented 2 years ago

I tried to create a one click install app and it does work. Just to be sure the "Container HTTP Port" is suppose to be 80 right?

sandoche commented 2 years ago

I'll try the reboot of the server

sandoche commented 2 years ago

Also I tried with SSH and docker exec to enter in the container and wget localhost, I do get the right content of the index. It looks like the container port doesn't work as it should.

sandoche commented 2 years ago

I did the reboot, still the same problem :/

sandoche commented 2 years ago

Note that I already had a laravel project, I just added the captain-definition file and the .deploy folder

sandoche commented 2 years ago

I also tried to recreate a caprover app from the same github repo (and the same env variable) and same issue with the new container.

jackbrycesmith commented 2 years ago

Just to be sure the "Container HTTP Port" is suppose to be 80 right?

Yep port 80 should work fine, you could try a higher port e.g. 8080 by adding that to the caddyfile & add it to the EXPOSE in the dockerfile, and of course updating the "Container HTTP Port".

But i would be surprised if that is the issue; i've been using variations of this template across multiple apps deployed on different servers for years now.

If you're able to share the project i can try and replicate & debug on my vps, otherwise I'm out of ideas right now...

jackbrycesmith commented 2 years ago

Also I tried with SSH and docker exec to enter in the container and wget localhost, I do get the right content of the index.

Could you try also try doing this from a different container? e.g. http://srv-captain--APPNAME

sandoche commented 2 years ago

Also I tried with SSH and docker exec to enter in the container and wget localhost, I do get the right content of the index.

Could you try also try doing this from a different container? e.g. http://srv-captain--APPNAME

This actually works!

sandoche commented 2 years ago

I am not sure what to do :/ Maybe I should try to reinstall my VM with Caprover

sandoche commented 2 years ago

I'll try to run this project in another caprover I have in another server.

jackbrycesmith commented 2 years ago

Also I tried with SSH and docker exec to enter in the container and wget localhost, I do get the right content of the index.

Could you try also try doing this from a different container? e.g. http://srv-captain--APPNAME

This actually works!

Nice that suggests an nginx issue, you could try and see if anything weird is appearing in the logs when trying to access the app...

docker service logs captain-nginx --follow --since 10m
sandoche commented 2 years ago

It does work on my other server with caprover.

sandoche commented 2 years ago

So I guess I did something wrong when I installed caprover, I'll reset the server and do a fresh install. Thanks for your help!

jackbrycesmith commented 2 years ago

Yeah though it's definitely a strange one as you say other apps are routing fine. No worries!

sandoche commented 2 years ago

Actually I found the issue, after reinstalling I had the issue again, it was the firewall (not sure what port was problematic though), I just removed fully the firewall for now.