Add a Docker based development environment#5
Conversation
7b6d91d to
d07f4ad
Compare
d07f4ad to
be754b8
Compare
|
No, I couldn't test it, as I currently don't have a running Docker
environment anywhere.... :-( But on paper it looks good. ;-)
|
|
I've made a configuration which adds:
Shall I simply push my commits to this branch and merge request? (Alas, I'm having some trouble with line endings to be able to easily run git from the containers and VSCode...) |
|
Sorry @julmud, it has been a busy week, I've not found as much "free" time as I'd hoped. My Local branch also fixes the iconv issue. Good to hear you did the .devcontainer, I also started that but did not get it to a point where I was happy with it. Yep please either push to the branch or send me the patches. I will rebase the commits and provide correct attribution before we merge. |
|
@gjnoonan I've been unsuccessful in pushing directly the commits to your branch or this pull request, so I've sent you an email with the patches. ;-) |
0b0d7a6 to
17b9fd5
Compare
|
@julmud I reviewed your patches earlier, via email :-) if you could rebase against my latest push then they should apply cleanly. |
179134e to
1821d21
Compare
4de1269 to
35ef303
Compare
hmm sorry about that, I must not have paid enough attention after my last rebase. |
2a31cc6 to
8f73906
Compare
|
Kudos, SonarCloud Quality Gate passed!
|
8f73906 to
ceeee71
Compare
|
Kudos, SonarCloud Quality Gate passed! |
To aid with development speed, as well as to ensure consistency, a standardised development environment has been created. We also provide a Makefile to take some more pain away which provides the following targeets: * `make install` - create .env, download dependencies, create the db, start everything up * `make start` - start the environment * `make stop` - tear it all down * `make reset` kill all the containers and run `install` Signed-off-by: Gavin-John Noonan <[email protected]>
With the default alpine image, the iconv library is wrongly configured, resulting in a PHP notice (iconv(): Wrong charset, conversion from `ISO-8859-1' to `ascii//TRANSLIT' is not allowed in /var/www/functions.php on line 1033) when running an update. Adding the GNU libiconv library to the image solves this problem.
The devcontainer allows us to run everything directly in containers from the Visual Studio Code GUI. Adding git to the base image, so that all version control operations can be done directly when running the containers from Visual Studio Code.
For easier debugging with Visual Studio Code, add the xdebug extension to the PHP installation, and a configuration for debugging the project from the GUI. Note that xdebug connects to port 9229, as the default port of 9000 is already being used by php-fpm.
|










Whilst this works, and is what I have been running locally, it is not quite ready to go into master yet; I still need to rebase and split out the commits. However I thought I would push this up as a draft to allow people to raise comment/suggestions.
I've used alpine as the container as it is lightweight and produces a nice small image and is generally really good for this application. The main error that comes up at the moment is:
I know why the first one errs and the second one can be ignored as it only displays because of the first. At the moment it doesn't stop anything from working. I may switch alpine out for debian if it proves a pain
I've added a Makefile for convenience, I realise that a Powershell file may need to be included too (or indeed a VSCode .devcontainer) for those running windows, but I've had no chance to write/test one.
When you first clone the project and run
make installit will2)Build the docker containers. unless you have deleted the image, it has changed, or you have run
resetthis will only happen the first time and will be quite slow.From here all you need to do is visit the webpage via port 8080, upload your Collection.XML via the usual method and then everything is ready to go. You can edit your PHP files locally and the changes will be reflected.
during development you should not have to run
make installagain, just usemake startandmake stopMySQL will automatically create the database, and run schema.sql to set-up the required structure once the container has been started.
If you don't want to, or can't run the Makefile then you can run the steps manually:
On a side note, as part of another patch series/MR I would like introduce a standard Collection.xml fixture into the database to use for development. I have one that I used locally when developing #2. This contains a few Blu-Rays and UltraHD titles; However, if we add a DVD, HD-DVD, as well as a release or two in non-english languages we should have enough to make sure nothing is breaking :-)
note: If you would like to test this out, in your localsiteconfig.php file set
$dbhost = 'db';this wall of text will be cleaned up into something more cohesive before it is taken out of draft