You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.4 KiB
Markdown

# aLeaf
A website/framework built around leaf-php, containerised for convenience of differing PHP versions.
If run on production (i.e. you're a server host), recommended to use a base install of nginx, php, etc. rather than the containers (for devops).
## Nginx Proxy Manager
Run NPM (or just standard Nginx) on the server and route the container_name:port through there for ease of development on multiple sites/projects.
## Docker
Dockerfile(s) are any run during the build process (so first instance of run, unless build specified).
So use them to do the automatic scripting that you would otherwise need to do manually, i.e. database creations, imports, etc for first run.
### Rebuild with Dockerfiles
sudo docker compose down && sudo docker compose build --no-cache && sudo docker compose up -d --force-recreate --build
--build at end may not be needed, but was for me
### Just restart
sudo docker compose down && sudo docker compose up -d
#### Replacing DB with docker build
You will need to delete the mysql folder I believe.
```sudo rm -rf /home/nathan/docker_vol/aleaf_mariadb```
Once it's run/built once I recommend using a script to replace/re-import data, etc.
## Accessing the container
sudo docker exec -it aLeaf-php /bin/bash # For running leaf scripts/composer, etc
sudo docker exec -it aLeaf-mariadb mysql -unathan -p # For SQL
sudo docker exec aLeaf-mariadb mysql < <script_file> # To run a script file (maybe)
sudo docker exec -it aLeaf-nginx /bin/bash # To check nginx issues
sudo docker exec -it aLeaf-nginx nginx -s reload # Restart nginx (not the container, just the service)
## Multiple sites on same docker stack (just in case)
## Leaf uses apache, I use nginx
https://winginx.com/en/htaccess
htaccess files generated can be switched to nginx with this
## TODO
- inotifywait/entr on default.conf change, to restart nginx server on container
## Leaf create (cli to make a starter app if nothing already)
leaf create my-app --mvc
sudo docker exec -it aLeaf-php leaf create html/mvc --mvc
leaf create basic --basic
composer create-project leafs/mvc:v4.0-beta my-app
## Shared folders in windows (virtualbox) VMs
Need to do this or symlinks don't work, and that messes up a bunch of composer stuff
### Ignore this, in future for my own less-dependency application
leaf create basic --basic
leaf install bareui
mkdir basic/app/{controllers,database,models,routes,views/{components,errors,layouts,pages}} -p // https://askubuntu.com/a/828864