The template site is a staple of the Center for Applied AI and should be treated with respect. Yes, it uses PHP, but all in all it is a great starting point for a web project. In this integration, we use the LAPP stack which is an easy-to-learn, fast web dev experience.
- Docker (and docker compose)
- PGAdmin (not necessary but helps)
- Check the docker-compose.yml file to change configs that suit your needs.
- In
frontend/, copyconfig.php.exampletoconfig.phpand input your variables. - In
backend/postgres/, copyinit.sql.exampletoinit.sqland add additional roles (if necessary, at the bottom of the file). Also, under the INSERT for roles there is another INSERT for an initial user, put your linkblue in the tag (i.e. abc123). You don't have to change the other parameters. - In the root of the project, copy
.env.exampleto.envand input your variables. The database will be connected with these parameters, so be mindful. - Run
docker compose up -d(ordocker-composedepending on your docker version) - Run
docker psto get the first four characters of the PHP container hash (use it in the next step) - Run
docker exec -it #### /bin/sh - Run
composer installwhile still in the docker container (if there is an error trycomposer update)
Configure TEMPLATE_REPO_URL=https://github.com/innovationcore/template-site.git in .env. Change this link if the template repo URL has changed. Then, run the template_merge.sh script. Running
./template_merge.sh
will pull changes from the template repo and display what files have changed.
./template_merge.sh --auto-merge
will merge the changes in, identify where there were merge conflicts, and instruct you how to finish the merge after fixing all conflicts.
- Add handling to include the necessary controller/utility file in
frontend/routes.php - Add routes under the
PluginsController routessection offrontend/routes.php - Add the plugin details to
backend/postgres/init.sqlto add the plugin to the database - Add require once for the necessary model file in
frontend/models/Plugin.php - Add any specific handling required for activation/deactivation to the
updateActivation()function infrontend/models/Plugin.php
NOTE:
A database initialization file is provided in backend/postgres/init.sql, feel free to change this to suit your needs. This script will run automatically on docker compose, and may take up to 30 seconds to complete once the container is running.
Backups of the database can be performed using backend/postgres/create_pg_backup.sh script. You run
create_pg_backup.sh [container_name]
or add to the crontab by running
crontab -e
and adding
# Daily backup at 2 AM (will use ${PROJECT_NAME}_postgres container)
0 2 * * * /path/to/your/create_pg_backup.sh >/dev/null 2>&1
This will save the backup to backend/postgres/backups/. Backups can be loaded using the backend/postgres/restore_pg_backup.sh script.
The developers in the UK Center for Applied AI should be credited in creating and maintaining this platform (specifically Caylin Hickey and Sam Armstrong). #PutSomeRespectOnMyName
We've chosen to use the GNU GPLv3 license for this software, but really we don't care what you do with it. Just give us some credit when you make it big.