All Projects → ibrunotome → docker-laravel-appengine

ibrunotome / docker-laravel-appengine

Licence: MIT License
Laravel dockerized with official Google App Engine flexible php environment + swoole.

Programming Languages

Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to docker-laravel-appengine

GaeSupportLaravel
Run Laravel on Google App Engine
Stars: ✭ 22 (-66.67%)
Mutual labels:  appengine, gae, appengine-php
Alphp
A micro PHP Docker environment based on an Alpine image. Can be used for container publishing, the completed image is only 30-40M
Stars: ✭ 100 (+51.52%)
Mutual labels:  alpine, swoole
deploy-appengine
A GitHub Action that deploys source code to Google App Engine.
Stars: ✭ 184 (+178.79%)
Mutual labels:  appengine, gae
docker-swoole-webapp
Simple Docker-image to build your applications based on Async PHP extensions.
Stars: ✭ 26 (-60.61%)
Mutual labels:  alpine, swoole
gae-postgres
Connect to Cloud SQL for PostgreSQL from Google App Engine
Stars: ✭ 23 (-65.15%)
Mutual labels:  postgres, appengine
gae-vue-webapp2-starter
A simple GAE Vue Webapp2 starter project.
Stars: ✭ 17 (-74.24%)
Mutual labels:  appengine, gae
Endoflife.date
Informative site with EoL dates of everything
Stars: ✭ 296 (+348.48%)
Mutual labels:  postgres, alpine
static-php-cli
Build single static PHP binary in linux, build with PHP project together, with Swoole and other popular extensions included.
Stars: ✭ 129 (+95.45%)
Mutual labels:  alpine, swoole
rdm-app
Code for the rdm.openlighting.org site
Stars: ✭ 17 (-74.24%)
Mutual labels:  appengine, gae
php7-alpine
Docker container for PHP 7 in Alpine Linux, with almost all extensions that you may need
Stars: ✭ 20 (-69.7%)
Mutual labels:  alpine, swoole
docker-webtop
Ubuntu, Alpine, Arch, and Fedora based Webtop images, Linux in a web browser supporting popular desktop environments.
Stars: ✭ 498 (+654.55%)
Mutual labels:  alpine
node-starter-kit
Node.js / GraphQL project template pre-configured with TypeScript, PostgreSQL, login flow, transactional emails, unit tests, CI/CD workflow.
Stars: ✭ 76 (+15.15%)
Mutual labels:  postgres
swoole-futures
⏳ Futures, Streams & Async/Await for PHP's Swoole asynchronous run-time.
Stars: ✭ 100 (+51.52%)
Mutual labels:  swoole
alpine-vagrant
This builds an up-to-date Vagrant Alpine Linux Base Box
Stars: ✭ 22 (-66.67%)
Mutual labels:  alpine
hypercorn-fastapi-docker
Docker image with Hypercorn for FastAPI apps in Python 3.7, 3.8, 3.9. Ready for HTTP2 and HTTPS
Stars: ✭ 18 (-72.73%)
Mutual labels:  alpine
boilerplate
Fullstack boilerplate using Typescript, React, Node & GraphQL
Stars: ✭ 738 (+1018.18%)
Mutual labels:  postgres
PostgreSQLClient
PostgreSQL connector for Godot Engine in GDScript.
Stars: ✭ 28 (-57.58%)
Mutual labels:  postgres
dababy
Data binding so simple even DaBaby could do it!
Stars: ✭ 27 (-59.09%)
Mutual labels:  alpine
node-backend-template
A template for NodeJS backend projects
Stars: ✭ 19 (-71.21%)
Mutual labels:  postgres
docker-alpine-miniconda3
The smallest Docker image with Miniconda3 (Python 3.7) (~143MB)
Stars: ✭ 94 (+42.42%)
Mutual labels:  alpine

Laravel dockerized with official Google App Engine flexible php environment + swoole (ready for production).

Repo archived on 2021-06-04

I've been using Kubernetes for almost two years now and I don't see any reason for anyone to use GAE, it's much more expensive and doesn't give any advantage over GKE, in fact, it has many disadvantages. Also, there is no more reason to use this third packages for swoole since it's now available as an oficcial package Octane.


You can build this image for production on GAE flexible using auto managed redis (Memory Store service) and database (SQL service) by Google Cloud Plataform building from Dockerfile, or run all locally using the docker-compose file.

Tips to customization

With this container you can edit php.ini, nginx.conf, fastcgi_params, gzip_params, supervisord.conf and php-fpm.conf files, just add them to the root folder and make your changes, they will be used on the next docker-compose up --build or on your next deploy to GAE using gcloud app deploy. All the original files related can be found here.

The supervisord.conf file is ready to run the swoole server and horizon at the start, and the php artisan schedule:run command each minute.

Example of repo using this container

https://github.com/ibrunotome/laravel-api-templates

The above repo use the swooletw/laravel-swoole package. Just choose one of the structures (default delivered by Laravel, or a structure inspired in DDD), and run docker-compose up. It's up and running :)

Swoole

I did some edits in Dockerfile, extending the official image (gcr.io/google-appengine/php72:latest) to enable swoole extension to get better performance (almost 400 reqs/sec on a real laravel world application with database/redis, etc) and 3000 reqs/sec with nginx micro cache. If you wanna use swoole with laravel, you can install one of the following packages:

swooletw/laravel-swoole

This package offers an easy plug and play of swoole into your Laravel application.

https://github.com/swooletw/laravel-swoole

After that, you have published the package configs and set the port on swoole_http.php file to match with the port that you are listening on your upstream of nginx.conf file (the current port is 9000), and set start the server on supervisord.conf, you just need to start your server and the nginx acts as a reverse proxy to your swoole server.

hhxsv5/laravel-s

If you want to put your hands in many of the truly skills of swoole (goroutines, asyncronous tasks/events, millisecond cron jobs), you can install the following package.

https://github.com/hhxsv5/laravel-s

FPM

If you wanna use php-fpm instead of swoole extension (seriously, WHY?), so remove swoole extension from php.ini and the swoole program from supervisord.conf, uncomment the php-fpm program of supervisord.conf file and remove the related lines of swoole from Dockerfile.

F.A.Q

  • Can I use this image with pure php or other frameworks instead of Laravel? Sure

How to use it locally

  • You need to have docker and docker-compose installed.
  • Put the files of this repo in the root of your laravel project.
  • Configure your .env to point to the docker-compose services (like pgsql for db host, or redis-cache for redis host)
  • Run docker-compose run app bash -c "composer update"
  • Run docker-compose run app bash -c "php artisan migrate:fresh --seed"
  • Run docker-compose up -d
  • That's all folks :) Now you have locally exactly the same image that you run on GAE flexible php environment.
  • Of course, remember to bind your .env variables and hosts with your docker-compose.yml file.

How to deploy it to Google App Engine (GAE)

Just put all the files of this repo on the root of your laravel project, then change your app.yaml section: runtime: php to runtime: custom, and deploy your application with gcloud app deploy command. That's it 🎉. You can learn more about GAE here: https://cloud.google.com/appengine/docs/flexible/

Deploy to GAE using a CI/CD pipeline

Google has an amazing CI tool called Cloud Build, it can easy run containers to test/deploy your code across multiple environments such as GAE, VMs, serverless, Kubernetes, or Firebase. Here an example of a Pipeline for laravel deploy using Cloud Build:

steps:
- name: 'gcr.io/cloud-builders/gsutil'
  args: ['cp', '.env.testing', '.env']
- name: 'docker/compose:1.23.1'
  args: ['run', 'app', 'composer', 'install', '--optimize-autoloader', '--no-interaction', '--no-ansi', '--no-progress', '--no-scripts', '--prefer-dist']
- name: 'docker/compose:1.23.1'
  args: ['run', 'app', 'vendor/bin/phpunit', '--no-coverage']
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['app', 'deploy', '--no-promote']
timeout: '1800s'
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].