2023-04-05 16:24:23 +00:00
# Cloud Apache Container #
2023-05-27 18:13:18 +00:00
This is the base container for running PHP based applications. Select the PHP version environment variables. PHP Version Defaults to PHP 8.1
2023-04-05 16:24:23 +00:00
2023-04-05 17:12:59 +00:00
*__You mush have docker or compatable containerization software running.__*
2023-04-05 16:27:03 +00:00
__You can pull this image locally by running:__
2023-04-05 16:24:23 +00:00
```console
2024-10-02 15:58:42 +00:00
docker pull repo.anhonesthost.net/cloud-hosting-platform/cac:latest
2023-04-05 16:24:23 +00:00
```
2023-05-27 18:13:18 +00:00
__You can then run a development version of the server by running the following commands:__
*Note this is an example, you can modify the command(s) to fit your needs.*
2023-04-05 16:24:23 +00:00
```console
mkdir -p local-development/domain.tld
cd local-development/domain.tld
2024-10-15 02:30:51 +00:00
mkdir user
mkdir -p user/logs/{apache,system}
2024-10-16 01:44:09 +00:00
docker run -d -it -p 80:80 -p 443:443 -e PHPVER=82 -e environment=DEV --mount type=bind,source="$(pwd)"/user,target=/home/myuser -v"$name-mysql":/var/lib/mysql -e uid=30001 -e user=myuser -e domain=localhost --name local-dev repo.anhonesthost.net/cloud-hosting-platform/cac:latest
2023-04-05 16:24:23 +00:00
```
2023-04-05 16:48:17 +00:00
*This will start the processes needed to run sites locally.*
2023-05-27 18:13:18 +00:00
The first time you start the container, it will take some time as it is installing all the required software to run the dev instance.
__If you need to get into the container you can run:__
2023-04-05 16:48:17 +00:00
```console
docker exec -it local-dev /bin/bash
```
__To install WordPress for your site__
```console
2024-10-16 01:44:09 +00:00
cat cat /home/myuser/mysql_creds
2023-04-05 16:48:17 +00:00
su - myuser
cd ~/public_html
wp core download
```
You should be able to then go into your browser and go to https://localhost (accept the SSL warning if it appears) and follow the prompts to setup the site.
2024-10-16 01:44:09 +00:00
The database credentials are shown in the /home/```$user```/mysql_creds file, which we had *cat* in the commands above.
2023-04-05 16:48:17 +00:00
2023-05-27 18:13:18 +00:00
### PHPVER ###
2023-04-05 16:27:50 +00:00
*74* - PHP 7.4
*80* - PHP 8.0
*81* - PHP 8.1
2024-10-16 01:50:11 +00:00
*82* - PHP 8.2
2024-10-02 15:58:42 +00:00
*83* - PHP 8.3
2023-04-05 16:24:23 +00:00
2023-04-05 16:27:03 +00:00
### Environment Variables ###
__Required Tags__
*uid* - User ID for File Permissions
*user* - Username for File Permissions
*domain* - Primary Domain for configuration
2023-04-05 16:24:23 +00:00
2023-04-05 16:27:03 +00:00
__Optional Tags__
*environment* - Set to DEV to start memcached and mysql locally for development purposes
2023-05-27 18:13:18 +00:00
*serveralias* - Set to allow alternative hostnames for a site.
*PHPVER* - Set to use a different version of PHP [refer to versions here. ](#phpver )
### Helpful Notes ###
2024-10-14 19:15:11 +00:00
* A cron is set up in the container to backup the database every 15 minutes to your user's directory.
2023-05-27 18:13:18 +00:00
* If you want to restart the instance again, run ```docker start {name-of-your-container}``` in the example, *name-of-your-cintainer* is *local-dev*
* To stop a restarted instance, run ```docker stop {name-of-your-container}```
* To view log stream from container, run ```docker logs -f {name-of-your-container}```
2024-10-14 19:15:11 +00:00
* To delete a container, run ```docker rm {name-of-your-container}``` *__Note:__ this does not delete the files in user directory or database, as those are store in your system*
2023-05-27 18:13:18 +00:00
* To view running containers, run ```docker ps```
* To view all created containers, run ```docker ps --all``
* To view all container images downloaded on your system, run ```docker images```