Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker support #34

Merged
merged 19 commits into from
Oct 5, 2022
Merged

Docker support #34

merged 19 commits into from
Oct 5, 2022

Conversation

grantmd
Copy link
Member

@grantmd grantmd commented Oct 3, 2022

Description

Adds Docker support. Useful for local development and running tests, but not (yet) for production serving. Tested on MacOS and Windows.

Rationale

12+ years on, Flamework remains the best option for quickly doing PHP projects. However, there's a lot of work to be done to bring this codebase up to modern PHP syntax and cloud hosting options. Before I started working on those I wanted a checkpoint for running tests that's not Vagrant (since Vagrant doesn't run natively on Apple silicon). Once the upgrades are done, the goal would be to make the docker container deployable by stripping down to just the PHP runtime (and Flamework code changes to support that).

The Now

This is mostly a port of the existing Vagrant scripts into Docker. It installs PHP 5.5.9, Apache 2.4.7, memcached 1.4.14, and MySQL 5.5.62. It looks like the version most-recently tested was PHP 5.4, but 5.5 was easy to find and runs cleanly.

All the daemons are all started in a single container, and basic SSL is configured. Enough config is put in place to connect to the database, but secrets need to be set to actually do login and set cookies. The SSL config is so ancient that modern browsers reject it outright and don't allow you to override, thus no auto-HTTPS upgrades are done.

If no flamework database is in place at container runtime, it is created. DB persistence is optional with Docker volumes, but otherwise wiped between runs to make test runs cleaner. Code is mounted from a volume so that live code editing can be supported.

Reasons not to use this in production (yet)

  • PHP is very outdated and has security vulnerabilities
  • The underlying OS is very outdated and has security vulnerabilities
  • This starts memcached, mysql, and apache2 in a single container (containers shouldn't run more than one daemon at a time)
  • No real effort is made to make this anything other than ephemeral
  • SSL is completely broken

The Future

Immediate work will be around adding more tests to exercise the existing code. Then PHP will be brought up to the most modern versions, which will involve at the very least removing mcrypt and upgrading Smarty (this is where more tests will be handy).

Additional goals in my head:

Other changes

  • Tests were updated because of iamcal.com changes
  • make docker target added
  • README notes on using the Docker image
  • .gitattributes set to eol=lf for shell scripts, since WSL (and therefore Docker on Windows) required it

@grantmd grantmd self-assigned this Oct 3, 2022
@grantmd grantmd added the docker label Oct 3, 2022
@grantmd grantmd marked this pull request as draft October 4, 2022 04:19
@grantmd grantmd linked an issue Oct 5, 2022 that may be closed by this pull request
@grantmd grantmd marked this pull request as ready for review October 5, 2022 17:39
@grantmd grantmd merged commit 6a8a312 into master Oct 5, 2022
@grantmd grantmd deleted the docker branch October 5, 2022 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project status
1 participant