Skip to content
This repository was archived by the owner on Jul 2, 2025. It is now read-only.

Add docker files to generate a development environment #1088

Merged

Conversation

christianlupus
Copy link
Collaborator

@christianlupus christianlupus commented Feb 20, 2020

This PR should bring support for #1071.

As there are credentials needed, the main archive needs to be set up accordingly before the PR should be merged. Further details can be discussed if the main PR can be approved.

@codecov-io
Copy link

codecov-io commented Feb 24, 2020

Codecov Report

Merging #1088 (a01747d) into master (9b15674) will increase coverage by 0.66%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1088      +/-   ##
============================================
+ Coverage     37.09%   37.75%   +0.66%     
+ Complexity     1798     1791       -7     
============================================
  Files           258      258              
  Lines          5729     5695      -34     
============================================
+ Hits           2125     2150      +25     
+ Misses         3604     3545      -59     
Impacted Files Coverage Δ Complexity Δ
...eBundle/EventListener/RequestExceptionListener.php 52.17% <0.00%> (-4.97%) 5.00% <0.00%> (ø%)
...r/StorageLocationBundle/Entity/StorageLocation.php 80.95% <0.00%> (-4.05%) 10.00% <0.00%> (ø%)
...rc/PartKeepr/CoreBundle/Services/SystemService.php 66.39% <0.00%> (-3.52%) 31.00% <0.00%> (ø%)
...octrineReflectionBundle/Services/FilterService.php 65.00% <0.00%> (-3.43%) 9.00% <0.00%> (ø%)
...rc/PartKeepr/ImageBundle/Services/ImageService.php 58.33% <0.00%> (-2.54%) 8.00% <0.00%> (ø%)
...undle/EventListener/TemporaryFileEventListener.php 82.85% <0.00%> (-2.22%) 23.00% <0.00%> (ø%)
...rtKeepr/AuthBundle/Action/ChangePasswordAction.php 80.64% <0.00%> (-2.12%) 10.00% <0.00%> (ø%)
src/PartKeepr/ProjectBundle/Entity/ProjectPart.php 84.78% <0.00%> (-1.89%) 21.00% <0.00%> (ø%)
...rtKeepr/ImageBundle/Controller/ImageController.php 86.44% <0.00%> (-1.50%) 16.00% <0.00%> (ø%)
src/PartKeepr/PartBundle/Services/PartService.php 82.27% <0.00%> (-1.48%) 21.00% <0.00%> (ø%)
... and 36 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d6e537e...5b39132. Read the comment docs.

@dromer
Copy link
Contributor

dromer commented Mar 2, 2020

I had a quick look at your docker setup this weekend, but need time to test it.
So far it seems a bit overly complex though. Personally I would probably go somewhat of a different route for this, but then again I don't know what caveats come out of this.

Hope to do some testing (and maybe try some things from scratch) on my end to get a better insight into how this would be used.

@christianlupus
Copy link
Collaborator Author

I am sorry, I did not (yet) write any documentation on it. Maybe I start with some rough sketches how things are intended/working. This is the next thing on my agenda.

@christianlupus christianlupus force-pushed the dev/docker-dev-helpers branch from 19b1ed7 to 21c0a61 Compare March 3, 2020 11:01
@christianlupus
Copy link
Collaborator Author

Just rebased onto latest master

@christianlupus
Copy link
Collaborator Author

@dromer I just joined the IRC chat room partkeepr on freenode. It might be simpler for us, if we needed to discuss details in a dialog than the chat system here. My username should be clupus there....

@dromer
Copy link
Contributor

dromer commented Mar 7, 2020

12:41.37 [FreeNode] -!- There is no such nick clupus

@christianlupus
Copy link
Collaborator Author

I just saw that the most recent changes break the development image when merged. Need to fix.

@christianlupus
Copy link
Collaborator Author

Was mislead, it should be working in the development image. The production image is still pending due to the required implementation of the code synchronization.

@christianlupus christianlupus mentioned this pull request Apr 2, 2020
@christianlupus
Copy link
Collaborator Author

I just pushed the latest docker images to the docker hub. You might want to use them as cache for building.

@christianlupus
Copy link
Collaborator Author

@dromer I reconsidered the discussion about apache vs nginx and the corresponding issues on PHP and docker. Why do we need to use nginx and PHP-FPM? This opens a can of worms and makes the whole docker development much more involved.

Please keep in mind, I am not talking about production usage. We are talking about development where the traffic is low, the number of users are at most one typically and the goal is to have something running quickly.

I confirm, that the production environment should be indenpendant of the HTTP server used and the FPM poses multi-core benefits as well as some simplifications regarding reverse proxying for nginx. No arguing there. I might be able to build dedicated docker images for these cases later as well.

But for now I see the synchronization issue between the PHP-FPM and the HTTP (be it apache or nginx) might be much more involved than a simple runnning container "all in one". That way the developer needs less knowledge about the debugging structure than when two containers need to stay in sync (or a volume and a host folder).

@christianlupus christianlupus self-assigned this Nov 1, 2020
@dromer
Copy link
Contributor

dromer commented Nov 11, 2020

Ok, I've been looking at this some more (sorry I haven't been getting emails lately. not sure what's up)

And considering all the example docker setups out there now:

Lets learn from all of this to at least get the ball rolling!

If you can take the lead on this I'll be ready to help test your instructions, ok?

@dromer
Copy link
Contributor

dromer commented Nov 13, 2020

@christianlupus

Can you move this effort to a branch on this repo?
Maybe after some cleanup/consolidation of the work?

@christianlupus
Copy link
Collaborator Author

OK, @ericmoon, I consolidated the docker setup a bit. I did not move to a branch on that repo because I think there is no way to change the PR's sources.
For now, there is a GH actions prepared to push the images to docker hub. This will fail currently as the secrets are not (yet) set up accordingly. If you have any questions, feel free to ask.

@christianlupus christianlupus marked this pull request as ready for review November 16, 2020 14:45
@ericmoon
Copy link
Collaborator

First glance looks good. I'll try and give a load and test in the next few days.

@christianlupus christianlupus marked this pull request as draft November 19, 2020 07:22
@christianlupus christianlupus force-pushed the dev/docker-dev-helpers branch 2 times, most recently from 0f4bc62 to 0d3e328 Compare November 19, 2020 10:11
@christianlupus christianlupus marked this pull request as ready for review November 19, 2020 10:13
@ericmoon
Copy link
Collaborator

ericmoon commented Dec 1, 2020

Took more than a few days (sorry), but it works great! Instructions are very good

(minor fix: remove the leading "." from the github.env files in the directions.)

@ericmoon
Copy link
Collaborator

ericmoon commented Dec 3, 2020

I was able to run unit tests inside of the dev docker container. 2 tests were skipped, so it's not perfect, but it seems to be working well.

Squashed commit of the following:

commit 35e66c7
Merge: 7968874 06321aa
Author: Christian <github@christianwolf.email>
Date:   Sat Dec 5 17:59:45 2020 +0100

    Merge pull request #7 from christianlupus/feat/readme-formatting

    Feat/readme formatting

commit 06321aa
Merge: 81c0aa2 7968874
Author: dreamer <dreamer@puikheid.nl>
Date:   Sat Dec 5 17:41:35 2020 +0100

    Merge branch 'dev/docker-dev-helpers' into feat/readme-formatting

commit 81c0aa2
Author: dreamer <dreamer@puikheid.nl>
Date:   Sat Dec 5 17:39:00 2020 +0100

    change the wording and some formatting

commit 7968874
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Dec 5 17:37:35 2020 +0100

    Removed unneeded password from docker dev setup

commit 3ee26d9
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Dec 5 17:36:35 2020 +0100

    Removed cron checking in dev environemnt

commit ae05b7c
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Dec 5 17:36:16 2020 +0100

    Removed issue with foreign key constraint in initdb routine

commit 0d3e328
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 11:05:49 2020 +0100

    Updated docker documentation how to use the images and how to build them

commit 3b646a5
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 10:22:50 2020 +0100

    Give project a useful name in docker-compose

commit 25bfa52
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 10:21:57 2020 +0100

    Removed typos in docker files

commit 5b39132
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 09:44:54 2020 +0100

    Check for existing configuration, add default ones for docker if not.

commit 08ab056
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 09:44:20 2020 +0100

    Corrected typo in comments

commit 032de54
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 19 09:44:04 2020 +0100

    Corrected docker setup: install all dependencies correctly

commit 9330acc
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Nov 16 15:27:45 2020 +0100

    Corrected name of image in various files

commit 85b8511
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Nov 16 15:24:51 2020 +0100

    Updated Github actions

commit 5523f2b
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Nov 16 15:13:25 2020 +0100

    Corrected the docs a bit

commit 28677d2
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Nov 16 15:13:16 2020 +0100

    Condensed the base-dev Dockerfile a bit

commit 4fa32e8
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Nov 16 14:23:40 2020 +0100

    Use a fixed version of composer to avoid conflicts with composer 2.x.

commit ddfa0ad
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Nov 12 17:55:18 2020 +0100

    Restrucured docker folders

commit 05a8110
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Mar 7 13:21:04 2020 +0100

    Tidied up some files

commit 70f4b2e
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Mar 7 13:10:11 2020 +0100

    Added some documentation

commit e78d246
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Feb 22 17:21:16 2020 +0100

    Enhanced structure for development image

commit 76bcf10
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Feb 22 17:11:30 2020 +0100

    Allow to add a personal GitHub token to the environment (for use of composer)

commit aba60bd
Author: Christian Wolf <github@christianwolf.email>
Date:   Sat Feb 22 16:52:12 2020 +0100

    Added speedup of docker build by using build cache on github

    Removed bug in build script on GitHub

    Still cache not correctly working. This should overcome it.

commit 8ad22c5
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Feb 20 16:14:38 2020 +0100

    Run crons upon restart of development image not only when forced

commit 7e0aef2
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Feb 20 16:13:57 2020 +0100

    Added basic code to reset upon restart of development environment

    Setting docker compose file to a save default for now

commit b4fa52e
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Feb 27 10:48:27 2020 +0100

    Separating the creation of the images into multiple stages
    This allows for parallelization.

    Added checkout to the various build stages

    Changed names of the stages to human-friendly ones

commit b355d74
Author: Christian Wolf <github@christianwolf.email>
Date:   Thu Feb 20 13:42:07 2020 +0100

    Redirected docker images to dockerhub

    Using the correct image in docker-compose file

commit e92dab3
Author: Christian Wolf <github@christianwolf.email>
Date:   Wed Feb 19 15:59:44 2020 +0100

    Restrict running of workflow to the master branch or any tag

commit c719064
Author: Christian Wolf <github@christianwolf.email>
Date:   Wed Feb 19 15:53:53 2020 +0100

    Enabled building of all images

commit 61e840c
Author: Christian Wolf <github@christianwolf.email>
Date:   Wed Feb 19 15:12:58 2020 +0100

    Removed bug in workflow as only a shallow clone was made

    Added debug statements to workflow

    Added fetch of tags

    Added origin of tags

    Typo in refspec removed

    Corrected spelling of fetch command

    Added unshallow aprameter to fetch

    Added more debug output

    Removed the bug reenabling build process

commit a25bd9e
Author: Christian Wolf <github@christianwolf.email>
Date:   Wed Feb 19 15:02:11 2020 +0100

    Added the workflow to build the docker images

    Corrected dockerfile location

commit 16abb4b
Author: Christian Wolf <github@christianwolf.email>
Date:   Wed Feb 19 14:53:15 2020 +0100

    Split docker image into base/development/production

    Split development in docker and preparation for workflow integration

commit adb9404
Author: Christian Wolf <github@christianwolf.email>
Date:   Tue Feb 18 09:58:16 2020 +0100

    Added automatic setup run using entrypoint script

commit c50a581
Author: Christian Wolf <github@christianwolf.email>
Date:   Mon Feb 17 14:37:13 2020 +0100

    Initial docker configuration created

    Added comment on origin of script

    Added modifications to make StyleCI happy

    Added phpinfo file to gitigore to be used by docker development

    Increased memory_limit of PHP

Signed-off-by: Christian Wolf <github@christianwolf.email>
@christianlupus christianlupus merged commit a6ce4c6 into partkeepr:master Dec 18, 2020
@christianlupus christianlupus deleted the dev/docker-dev-helpers branch December 31, 2020 15:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants