jolicode / docker-starter Goto Github PK
View Code? Open in Web Editor NEWποΈ A skeleton to start a new web project with PHP, Docker and Castor
License: MIT License
ποΈ A skeleton to start a new web project with PHP, Docker and Castor
License: MIT License
Right now this template provides a good GH Action boilerplate: https://github.com/jolicode/docker-starter/blob/main/.github/workflows/ci.yml
But it's building the whole project docker images every time.
The template should be optimized for future projects to have good test performances by default.
Hello Jolicode, Hello @damienalexandre,
J'utilise toujous avec grand plaisir votre stack.
Je suis tombΓ© sur un petit soucis de cache ces derniers temps avec des pages tjs en 502 bad gateway
En ajoutant dans le nginx.conf, ça semble résoudre le problème
fastcgi_buffer_size 128k;
fastcgi_buffers 4 256k;
fastcgi_busy_buffers_size 256k;
Je ne sais pas si vous voulez integrer la modif !
Bonne journΓ©e Γ vous
Xavier
Hello,
I think that it could be cool to add a plugin system, for specific use cases, that we don't want to implement directly in the starter.
Docker starter is a amazing tool to start a lot of types of projects using docker. We could perform some plugins to increase it relevance by adding a layer on it, with more dedicated containers and pre built configuration like :
An idea of how it could be work :
At the moment, composer is built-in on the "builder" image:
It means the Composer version you have depends on WHEN you builded the image / the project. So if I boot a very old project I was working on, it could have an old version of Composer.
But if I install this same project on a different machine, I will have the latest Composer.
My main issue today is that I have to destroy my "builder" image to upgrade Composer.
And as I notice this, I also fear that not specifying the major version of this critical build tool could introduce some surprises in the future (imagine, Composer 2.0, not 100% compatible with projects built years ago... You notice the error only when re-installing the project π₯).
Installing Blackfire.io is easy but we could help with a recipe I think.
Hi there,
Is there any reason to avoid mapping ports on "run" command ?
Line 179 in c319756
I just needed to add --service-ports option to the fabfile.py to run my container with port mapping embed.
π
Currently, SSL is available by default with auto-signed certificates. We already propose an alternative in a cookbook about Mkcert.
I suggest that we no longer provide self-signed SSL certificates BUT a start of the infrastructure should run by default a modified version of the task generate_certificates
.
docker ps
is nice to get an overview of what is running. But it gets more complicated when one wants to see what is down.
I have see several projects with fab ps
command and it think it's a good idea.
I think I would be faster to add it by myself but with this issue:
Since Symfony Asset Mapper v6.4, a new command was introduced : importmap:install
, which populates the new assets/vendor directory.
Running castor start
on a project using Asset Mapper 6.4 will result in some 500 errors because this directory will be empty, since this new command is never ran.
However, adding it is quite painful because we must check that the current project is actually using Asset Mapper and at least in v6.4.
So, maybe we shouldn't do anything and let the concerned projects add a docker_compose_run('bin/console importmap:install');
to their install()
function themselves ?
But then, we should probably at least update the README to notify users about it ?
#!/bin/bash -eo pipefail
set -e
pip install --user pipenv
~/.local/bin/pipenv install
Collecting pipenv
Downloading https://files.pythonhosted.org/packages/f6/fe/0adf70655fc4b6f0118f22489b3aac80b6f8a2cb38dd4bf071427eb82c14/pipenv-2020.6.2-py2.py3-none-any.whl (3.9MB)
100% |ββββββββββββββββββββββββββββββββ| 3.9MB 284kB/s eta 0:00:0101
Collecting enum34 (from pipenv)
Downloading https://files.pythonhosted.org/packages/6f/2c/a9386903ece2ea85e9807e0e062174dc26fdce8b05f216d00491be29fad5/enum34-1.1.10-py2-none-any.whl
Collecting pip>=18.0 (from pipenv)
Cache entry deserialization failed, entry ignored
Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
100% |ββββββββββββββββββββββββββββββββ| 1.5MB 783kB/s eta 0:00:011
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /opt/circleci/.pyenv/versions/2.7.12/lib/python2.7/site-packages (from pipenv)
Collecting virtualenv-clone>=0.2.5 (from pipenv)
Downloading https://files.pythonhosted.org/packages/83/b8/cd931487d250565392c39409117436d910232c8a3ac09ea2fb62a6c47bff/virtualenv_clone-0.5.4-py2.py3-none-any.whl
Collecting typing (from pipenv)
Downloading https://files.pythonhosted.org/packages/22/30/64ca29543375759dc589ade14a6cd36382abf2bec17d67de8481bc9814d7/typing-3.7.4.1-py2-none-any.whl
Collecting certifi (from pipenv)
Downloading https://files.pythonhosted.org/packages/98/99/def511020aa8f663d4a2cfaa38467539e864799289ff354569e339e375b1/certifi-2020.4.5.2-py2.py3-none-any.whl (157kB)
100% |ββββββββββββββββββββββββββββββββ| 163kB 6.5MB/s eta 0:00:01
Collecting setuptools>=36.2.1 (from pipenv)
Downloading https://files.pythonhosted.org/packages/12/86/59b9683467659dcaf2729d7bbfa1d05a83ec417863bca73367e68d299281/setuptools-47.3.0.zip (870kB)
100% |ββββββββββββββββββββββββββββββββ| 880kB 1.4MB/s eta 0:00:01
Complete output from command python setup.py egg_info:
pkg_resources/py2_warn.py:15: UserWarning: Setuptools no longer works on Python 2
************************************************************
Encountered a version of Setuptools that no longer supports
this version of Python. Please head to
https://bit.ly/setuptools-py2-sunset for support.
************************************************************
warnings.warn(pre + "*" * 60 + msg + "*" * 60)
----------------------------------------
Command "python setup.py egg_info" failed with error code 32 in /tmp/pip-build-4TBFDH/setuptools/
You are using pip version 8.1.1, however version 20.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Exited with code exit status 1
CircleCI received exit code 1
We must update our build process (pip ?)
Adding a License section with link to the license to the Readme file.
Hi!
Docker Compose v1 is EOL and deprecated, and it would be great to use the system's docker compose
instead of Python's docker-compose
.
The problem is that when you replace cmd = 'docker-compose -p %s %s %s' % (
with cmd = 'docker compose -p %s %s %s' % (
on line 295 of tasks.py, the environment vars are not taken into account anymore (even though they're passed to c.run
on ligne 308) and the runner fails to build if the Dockerfile uses an env var.
We run a lot of docker_compose_run
function, but the output is not really nice:
In utils.php line 194:
The command "'docker' 'compose' '-p' 'app' '-f' '/home/dalexandre/Dev/MyApp/infrastructure/docker/docker-compose.yml' '-f' '/home/dalexandre/Dev/MixWith
TheMasters/infrastructure/docker/docker-compose.worker.yml' '-f' '/home/dalexandre/Dev/MyApp/infrastructure/docker/docker-compose.builder.yml' '--env-fil
e=/home/dalexandre/Dev/MyApp/application/.env' 'run' '--rm' '--no-deps' 'builder' '/bin/sh' '-c' 'exec bin/phpunit'" failed.qa:tests
We should find a way to improve this.
The default output should not be the full command but only my task: bin/phpunit
.
I think castor exit_code do that. Maybe it could be a context option?
On some projects we have to add this to our Docker Compose files (platform: linux/amd64
);
version: '3.7'
volumes:
builder-data: {}
services:
php-base:
build: services/php-base
platform: linux/amd64
builder:
build: services/builder
platform: linux/amd64
To allow Macbooks with M1 chips to build.
It run but then it's painfully slow.
Could it be that our base images are not M1 compatible? Could we found images that runs anywhere?
Is there any PHP 8 support right now ?
Now that some of our tools (like PHPStan & Symfony linters) adapt their output when they run on CI, we could make it working inside our Docker infrastructure.
For this to work we probably only need to forward all CI env vars to the builder container - in which our tools are executed.
Hi!
Can we have the symfony app on the root of the project instead of in a subdirectory app
? If yes, what we should set in env.project_directory
?
Thanks
Hi,
I was trying to use the stack on a recently installed machine and encountered the following error on fab start
:
ERROR: Service 'frontend' failed to build: pull access denied for feedback_basephp, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
I fixed it using by manually running :
PROJECT_NAME=feedback docker-compose -p feedback -f ./infrastructure/docker/docker-compose.builder.yml -f ./infrastructure/docker/docker-compose.yml build --build-arg PROJECT_NAME=feedback --build-arg USER_ID=1000 php-base
I'm not sure what the "correct" way to fix this is, but I would be surprised to be the only one experiencing this error.
Thank you πΊ
Hello,
In our environment we need to be able to keep network_mode: "host"
for router
service while being able to connect to frontend
one from builder
service, for functional testing purpose with Panther ( β€οΈ ).
However using this mode Panther doesn't know how to reach the application on frontend (specified using PROJECT_DOMAINS
).
Do you have any idea on how to do it?
We should use https://docs.docker.com/compose/profiles/ and not labels
Since Python 2.7 is reaching EOL, and Fabrix 1.x isn't compatible with 3.x version, would it be possible to have the fabfile.py upgraded to use Fabrix 2.x and Python 3.x?
However they seem to have broken almost the whole API and the doc migrations are...awkward :(
Another alternative would be Fabric-classic
Hi all,
First, thank you to share this docker-starter.
Is it possible to expose PG/mysql during development ? by example for use database tool, like Dbeaver ?
Or it's a bad practice ?
Thank you !
It looks like the documentation contained in your README to use docker-starter
with webpack is outdated (using options which do not exist anymore).
I created an issue instead of a PR to directly correct the documentation because I have absolutely no idea of how to fix that... π
We want to use two Docker stater based project at the same time.
And project A needs to talk to project B.
It works well on Linux but as the network_mode "host" is not available on MacOS and Windows, we are stuck.
We added this on our frontend from project A:
frontend:
build: services/frontend
extra_hosts:
- 'project-b.test:172.17.0.1' # Allow talking to project B, docker0 IP
I was looking for some PHP docker starter template and found this one. However to set up the docker environment I need to have php installed locally because of castor. It doesn't make sense :)
We could add a linter for Dockerfile in the CI.
https://github.com/hadolint/hadolint/blob/master/docs/INTEGRATION.md#github-actions
Add this:
$ inv destroy
Are you Sure? [Y/n]
At the end of "inv start" we print all the configured URL:
Lines 51 to 53 in c7bdf35
That's awesome but we can never this is again, unless running "inv start" again.
Would be awesome if the help / task list could add this. Or add a "inv help" or "inv url" command to get the list back any time.
WDYT?
The composer global config cache-dir -q
command ran on the host can return a different result.
For example, on Debian 5.5 with composer 1.10.6 it's ~/.cache/composer
instead of ~/.composer/cache
.
As the volume mounted for the builder use the second option, a non reusable ~/.composer/cache
folder is created (with root) on my host.
I "solved" the problem using a symlink but if you have a more elegant solution, don't hesitate to tell me. :)
It should be great to remove the warning on the builder Dockerfile because of the programmatically usage of apt-key :
Warning: apt-key output should not be parsed (stdout is not a terminal)
It seems that there 2 ways to remove this warning :
Both seems ignoring the real security content of the message π
apt-key is used to manage the list of keys used by apt to authenticate
packages. Packages which have been authenticated using these keys will
be considered trusted.
Note that if usage of apt-key is desired the additional installation of
the GNU Privacy Guard suite (packaged in gnupg) is required. For this
reason alone the programmatic usage (especially in package maintainer
scripts!) is strongly discouraged. Further more the output format of all
commands is undefined and can and does change whenever the underlying
commands change. apt-key will try to detect such usage and generates
warnings on stderr in these cases.
=> For this reason alone the programmatic usage (especially in package maintainer scripts!) is strongly discouraged.
Solution 1 : using an older version of nodejs who is officially supported by this version of Debian π’
Solution 2 : accept this warning (it's working with)
Solution 3 : ... feel free to propose any better solution :)
Currently, we are using Alpine as the base image for almost all services. At the time, this was the recommended base image and Docker themself move their own images on Alpine too.
2020 could be the year we switch back to Debian as nowadays they provide official image that no so big (like debian:buster-slim
?). Here is some pro/cons:
Pros:
musl
library instead of classical libc, which used to break some tool like BlackfireCons:
Some read:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.