GithubHelp home page GithubHelp logo

jackbrycesmith / laravel-caprover-template Goto Github PK

View Code? Open in Web Editor NEW
124.0 124.0 42.0 24 KB

Template to deploy a Laravel app in docker for CapRover

License: MIT License

Dockerfile 88.50% Shell 11.50%
caddy caprover deployment docker laravel php

laravel-caprover-template's People

Contributors

jackbrycesmith avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

laravel-caprover-template's Issues

standard_init_linux.go:211: exec user process caused "no such file or directory"

Hello, I found some issues with the entrypoint.sh, I got the error:

standard_init_linux.go:211: exec user process caused "no such file or directory"

So I edited the Dockerfile last line to this, it's weird because the entrypoint.sh first line is calling #!/bin/sh. But, still, here it is.

ENTRYPOINT ["/bin/bash","/entrypoint.sh"]

Get real ip and host in application

Nice template btw ! I'm facing issue with getting client real IP and host whenever i called $request->getHost() or $request->ip() cause it always return local ip. What should I do and sorry I'm not familiar with caddy

Successful build but cannot access the website

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

Crontab issue

I can see this during image build

Step 5/39 : RUN (crontab -l ; echo "* * * * * /usr/local/bin/php /srv/app/artisan schedule:run >> /dev/null 2>&1") | crontab
 ---> Running in 224010ada790
no crontab for root

Websocket not working

Hey, thanks for the template. Very nicely done.

I followed your websocket instructions and clients can connect on port 443, it seems this only connects to caprover but not the laravel app.

I mean, php artisan websocket:serve uses port 6001 yet we connect port 443.

Looking at the nginx config has set $upstream http://<%-s.localDomain%>:<%-s.containerHttpPort%>; where containerHttpPort is 80.

So please, what's the proper way to get this working? Thanks

entrypoint.sh don't execute

the commands that exist in entrypoint.sh are not executed. I always have to access container to run manually

composer dump-autoload --no-interaction --no-dev --optimize

Only then are packages recognized

Error permission storage

without executing a deploy it always returns the same permission error in the storage directory

COPY failed: stat /var/lib/docker/tmp/docker-buildeXXXXX/composer.json no such file or directory

Hello,

I'm using your template but I found this error, I do not know how to fix it. Can somebody help me please?

`{"message":"COPY failed: stat /var/lib/docker/tmp/docker-builder202529140/composer.json: no such file or directory"}
COPY failed: stat /var/lib/docker/tmp/docker-builder202529140/composer.json: no such file or directory
Build has failed!

Deploy failed!
Error: {"message":"COPY failed: stat /var/lib/docker/tmp/docker-builder202529140/composer.json: no such file or directory"}
COPY failed: stat /var/lib/docker/tmp/docker-builder202529140/composer.json: no such file or directory`

Thanks in advanced.
Captura

GitLab CI/CD Deployment

Not really an issue. Just seeking advice and guidance.

I just found and learned to use CapRover today. Your template helped and I have successfully deployed my laravel app to my server. My repo is on GitLab and I'm currently using webhook for auto deployment.

I would like to use GitLab CI/CD for the deployment instead of webhook. How can I set up CI/CD with this template?

I have read the CapRover docs for CICD but I am not very clear. It says to just use Docker file, so should I delete captain-definiton file and move Docker out of .deploy folder? And do I have to update the variables in the Docker file or just use as it is?

I'm noob at docker and all this.
Any help is appreciated.

Error on entrypoint.sh

I have this error on deploy and caprover response NGINX 502 Error :/

2020-11-24T21:23:08.109626638Z /entrypoint.sh: line 2: $'\r': command not found
2020-11-24T21:23:08.109652138Z /entrypoint.sh: line 4: $'\r': command not found
2020-11-24T21:23:08.109663539Z ๐ŸŽฌ entrypoint.sh
2020-11-24T21:23:08.276572103Z
2020-11-24T21:23:08.280577312Z
2020-11-24T21:23:08.280620712Z [Symfony\Component\Console\Exception\RuntimeException]
2020-11-24T21:23:08.280624912Z The "--optimize
" option does not exist.
2020-11-24T21:23:08.280627912Z
2020-11-24T21:23:08.280630712Z
2020-11-24T21:23:08.280633312Z dump-autoload [--no-scripts] [-o|--optimize] [-a|--classmap-authoritative] [--apcu] [--no-dev]
2020-11-24T21:23:08.280637812Z
2020-11-24T21:23:08.285838523Z /entrypoint.sh: line 6: $'\r': command not found
2020-11-24T21:23:08.286099024Z ๐ŸŽฌ artisan commands
2020-11-24T21:23:08.286635725Z /entrypoint.sh: line 8: $'\r': command not found
2020-11-24T21:23:08.307761171Z
2020-11-24T21:23:08.307775571Z Warning: require(/srv/app/vendor/autoload.php): failed to open stream: No such file or directory in /srv/app/artisan on line 18
2020-11-24T21:23:08.307779171Z
2020-11-24T21:23:08.307781771Z Fatal error: require(): Failed opening required '/srv/app/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /srv/app/artisan on line 18
2020-11-24T21:23:08.327468414Z
2020-11-24T21:23:08.327508614Z Warning: require(/srv/app/vendor/autoload.php): failed to open stream: No such file or directory in /srv/app/artisan on line 18
2020-11-24T21:23:08.327513114Z
2020-11-24T21:23:08.327515514Z Fatal error: require(): Failed opening required '/srv/app/vendor/autoload.php' (include_path='.:/usr/local/lib/php') in /srv/app/artisan on line 18
2020-11-24T21:23:08.329775519Z /entrypoint.sh: line 11: $'\r': command not found
2020-11-24T21:23:08.329920220Z ๐ŸŽฌ start supervisord
2020-11-24T21:23:08.330173520Z /entrypoint.sh: line 13: $'\r': command not found
2020-11-24T21:23:08.334358729Z time="2020-11-24T21:23:08Z" level=info msg="stop listening"

Queue?

Hello,

Any ideas/suggestions on how to handle a queue worker? I assume the easiest would be to use supervisor and add another config setting similar to how the horizon is handled.

But I think a better solution would be to have a separate container for the queue worker?

Anyone figure that part out?

Nginx deployment

Hi,

I am struggling to deploy my laravel app using this template, it works with caddy but i would like to use nginx. Any help will be much appreciated.

ARM support

Hello,

Thanks for this great guide.

When I inspect my application logs, I get this error message:

/ usr / local / bin / supervisord: line 1: syntax error: unexpected "("

It runs in a loop and it regenerates the entrypoint.sh

โ€ฆ
2021-04-07T13:39:55.111028320Z ๐ŸŽฌ start supervisord
2021-04-07T13:39:55.113866848Z /usr/local/bin/supervisord: line 1: syntax error: unexpected "("
2021-04-07T13:40:01.232137156Z ๐ŸŽฌ entrypoint.sh: [app] [PHP 8.0.3]
2021-04-07T13:40:01.353809899Z Generating optimized autoload files
2021-04-07T13:40:02.307670653Z > Illuminate\Foundation\ComposerScripts::postAutoloadDump
2021-04-07T13:40:02.322985510Z > @php artisan package:discover --ansi
2021-04-07T13:40:02.465557439Z Discovered Package: cviebrock/eloquent-sluggable
2021-04-07T13:40:02.465614735Z Discovered Package: fideloper/proxy
2021-04-07T13:40:02.465619075Z Discovered Package: fruitcake/laravel-cors
2021-04-07T13:40:02.465637545Z Discovered Package: intervention/image
2021-04-07T13:40:02.465643026Z Discovered Package: laravel/legacy-factories
2021-04-07T13:40:02.465646218Z Discovered Package: laravel/tinker
2021-04-07T13:40:02.465671498Z Discovered Package: mpociot/teamwork
2021-04-07T13:40:02.465692938Z Discovered Package: nesbot/carbon
2021-04-07T13:40:02.465707674Z Discovered Package: plank/laravel-mediable
2021-04-07T13:40:02.465778189Z Discovered Package: spatie/laravel-json-api-paginate
2021-04-07T13:40:02.465803534Z Discovered Package: spatie/laravel-query-builder
2021-04-07T13:40:02.465901897Z Discovered Package: tymon/jwt-auth
2021-04-07T13:40:02.465909897Z Discovered Package: vinkla/hashids
2021-04-07T13:40:02.465974323Z Package manifest generated successfully.
2021-04-07T13:40:02.475253980Z Generated optimized autoload files containing 4659 classes
2021-04-07T13:40:02.484469187Z ๐ŸŽฌ artisan commands
2021-04-07T13:40:02.671298620Z Nothing to migrate.
2021-04-07T13:40:02.679109450Z ๐ŸŽฌ start supervisord
2021-04-07T13:40:02.681900930Z /usr/local/bin/supervisord: line 1: syntax error: unexpected "("
...

Can you help me find out why it does this?

Laravel 8 and PHP 8.0.3 (server: AWS EC2 T4G)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.