This code allowed me to edit posts in pure markdown and push changes to the repo. After that the server will pull down changes and update the website. Nice :)
Features:
- markdown based posts converted to HTML
- it generates static HTML files (as explained in the post)
- it uses Blade templates
./develop serve tests/Infrastructure/HTTP/router.php
to start a built in web server./develop test
to run tests./develop composer update
to update dependencies
Deployment is done in steps:
- setup webserver and create a folder for the website
- run
php deploy.php
to download the repo - create and set values in
.env
file - add github webhook to react on new pushes, make it run this command on each new push
php deploy.php
- Nginx config on the server to support github hooks:
location /github-webhook/*****/ {
content_by_lua_block {
os.execute("cd <PROJECT_DIR> && sudo /usr/local/bin/docker-compose -f docker-compose.prod.yml build --no-cache app");
os.execute("cd <PROJECT_DIR> && sudo /usr/local/bin/docker-compose -f docker-compose.prod.yml exec -w /var/www app php deploy.php");
os.execute("cd <PROJECT_DIR> && sudo /usr/local/bin/docker-compose -f docker-compose.prod.yml restart app");
}
}