Something about how awesome this is
When creating new thumbs for retouch:
- first create 90 (short side) thumbs:
convert -resize x90 EmilyAfter.jpg Emily.jpgORconvert -resize 90x EmilyAfter.jpg Emily.jpg - then crop it:
convert Emily.jpg -gravity center -crop 90x90+0+0 +repage Emily.jpg
Everything is orchestrated with Docker and docker compose
To build and deploy locally, simply run
docker compose up --buildThe ssl certificate is done with certbot for letsencrypt and the certs themselves live on the host machine. Used this blog post for basic setup, and this page for jamming in certbot into our php container
To update the cert, install certbot according to the above instructions, or use the below. docker exec into the php container and then run the below commands:
apt update && apt install -y certbot python3-certbot-apache
certbot renew --dry-runIf you get an error about Error Parsing variable: ${SERVER_NAME}, go into the apache conf files and
update ${SERVER_NAME} on the first 4 lines to saperstonestudios.com and then re-run the dry-run command.
If you get an error installing a dependency (when doing a pip install), sometimes you need to install an
older version of that dependency. This happened with python-augeas. Version 1.2 kept failing to install,
and manually installing version 1.1 make the rest of the commands work.
/opt/certbot/bin/pip install --force-reinstall -v "python-augeas==1.1"
If all of the above works, finally run the below command:
certbot renewI had issues with the newer certbot implementations, and needed to do a manual DNS challenge. This should probably be looked at, and resolved, maybe even by setting up certbot as a separate networked container. The command that works is:
certbot certonly --manual --preferred-challenges dns -d saperstonestudios.comAfter this, you may need to restart the docker container, or even run the
command again, specifying
Renew & replace the certificate (may be subject to CA rate limits) and
then restarting the container
docker restart saperstonestudios_phpThe better option is to split responsibility, running certbot in a separate container. A snippet example is below:
services:
web:
image: php:8.4-apache-bookworm
ports:
- "80:80"
- "443:443"
volumes:
- ./letsencrypt:/etc/letsencrypt
certbot:
image: certbot/certbot
volumes:
- ./letsencrypt:/etc/letsencrypt
- ./www:/var/www/html
command: certonly --webroot -w /var/www/html -d saperstonestudios.com --email you@example.com --agree-tos --non-interactiveAll the testing is managed by composer. To run tests, ensure composer is
installed, then run the desired commands from below
composer unit-testThis will not only run the unit tests, but also calculate the code coverage for the unit tests. The most useful results are displayed on the commandline, but if you want something for the record, the below reports are generated:
- junit:
reports/ut-junit.xml - testdox:
reports/ut-results.html - clover coverage:
reports/ut-coverage/index.html
Before you can run the integration tests, a database must be stood up to run against. If the application is deployed, that will work, otherwise, stand up a database for testing with the below:
composer integration-pre-testOne you have a database stood up to run tests against, simply run the integration tests
composer integration-testThis will not only run the integration tests, but also calculate the code coverage for the integration tests. The most useful results are displayed on the commandline, but if you want something for the record, the below reports are generated:
- junit:
reports/it-junit.xml - testdox:
reports/it-results.html - clover coverage:
reports/it-coverage/index.html
TODO
Launch the app
docker compose up --build -dSetup local environment variables
set -a
source .env
set +a
export DB_HOST=localhostEnsure the api tools are built
composer clean
composer install --prefer-dist --no-progress --no-suggestEnsure the app is up
curl --retry 50 -f --retry-all-errors --retry-delay 5 -s -o /dev/null "http://localhost:90/"Run the tests
COMPOSER_PROCESS_TIMEOUT=1200 composer api-testinstall chromedriver
sudo apt install chromium-chromedriverrun chromedriver
chromedriver --port=4444run your tests
TBDWhen email issue pop, it's possible that the oauth token has expire. If you need
a new credentials.json file, instructions are here:
https://developers.google.com/gmail/api/quickstart/js. When updating the
credentials.json file, delete the token.json file and then run a test from the
commandline. When it pauses, hit enter to get the correct prompts. Be sure to
update the secrets in GHA.