julmud / phpDVDProfiler

Adoption of the defunct phpDVDProfiler
MIT License
1 stars 4 forks source link

Add a Docker based development environment #5

Open gjnoonan opened 4 years ago

gjnoonan commented 4 years ago

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:

Notice: iconv(): Wrong charset, conversion from `ISO-8859-1' to `ascii//TRANSLIT' is not allowed in /var/www/functions.php on line 1033

Warning: Cannot modify header information - headers already sent by (output started at /var/www/functions.php:1033) in /var/www/index.php on line 2884

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 install it will 1) copy the env.example file to .env 2)Build the docker containers. unless you have deleted the image, it has changed, or you have run reset this will only happen the first time and will be quite slow. 3) start all the containers in the background.

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 install again, just use make start and make stop

MySQL 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:

1) docker pull --parallel 2) docker build --no-cache --pull (the pull here makes sure you have the latest base image and won't use the local one if it exists) 3) docker-compose up 4) profit

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

julmud commented 4 years ago

No, I couldn't test it, as I currently don't have a running Docker environment anywhere.... :-( But on paper it looks good. ;-)

julmud commented 4 years ago

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...)

gjnoonan commented 4 years ago

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.

julmud commented 4 years ago

@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. ;-)

gjnoonan commented 4 years ago

@julmud I reviewed your patches earlier, via email :-) if you could rebase against my latest push then they should apply cleanly.

julmud commented 4 years ago

@julmud I reviewed your patches earlier, via email :-) if you could rebase against my latest push then they should apply cleanly.

@gjnoonan Is it normal that the docker-compose.yml file is missing from your latest commits? And the .env.example file seems to be missing too.

gjnoonan commented 4 years ago

@julmud I reviewed your patches earlier, via email :-) if you could rebase against my latest push then they should apply cleanly.

@gjnoonan Is it normal that the docker-compose.yml file is missing from your latest commits? And the .env.example file seems to be missing too.

hmm sorry about that, I must not have paid enough attention after my last rebase.

sonarcloud[bot] commented 4 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 2 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information