33If You want to build a website with CakePHP at short time;
44
55#### Full stack Nginx CakePHP:
6- <p align =" left " > <a href =" https://www.cakephp.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/23666?s=200&v=4 " alt =" cakephp " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
6+ <p align =" left " >
7+ <a href =" https://www.cakephp.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/23666?s=200&v=4 " alt =" cakephp " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
78<a href =" https://www.docker.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/docker/docker.png " alt =" docker " width =" 40 " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
89<a href =" https://mariadb.org/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/5877084?s=200&v=4 " alt =" mariadb " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
910<a href =" https://dev.mysql.com/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/2452804?s=200&v=4 " alt =" mysql " height =" 50 " width =" 50 " /> </a >  ;  ;  ;
@@ -16,7 +17,8 @@ If You want to build a website with CakePHP at short time;
1617<a href =" https://www.portainer.io/?hsLang=en " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/22225832?s=200&v=4 " alt =" portainer " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
1718<a href =" https://docs.docker.com/compose/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/docker/compose/v2/logo.png " alt =" docker compose " width =" 40 " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
1819<a href =" https://www.gnu.org/software/bash/ " target =" _blank " rel =" noreferrer " > <img src =" https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png " alt =" Bash " height =" 40 " width =" 40 " /> </a >  ;  ;  ;
19- <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a > </p >
20+ <a href =" https://www.offen.dev/ " target =" _blank " rel =" noreferrer " > <img src =" https://avatars.githubusercontent.com/u/47735043?s=200&v=4 " alt =" backup " height =" 35 " width =" 35 " /> </a >
21+ </p >
2022
2123Plus, manage docker containers with Portainer.
2224
@@ -45,7 +47,7 @@ Plus, manage docker containers with Portainer.
4547- [ webserver (nginx)] ( https://hub.docker.com/_/nginx )
4648- [ certbot (letsencrypt)] ( https://hub.docker.com/r/certbot/certbot )
4749- [ phpMyAdmin] ( https://hub.docker.com/r/phpmyadmin/phpmyadmin/ )
48- - [ databaseMariadb ] ( https://hub.docker.com/_/mariadb ) [ databaseMysql ] ( https://hub.docker.com/_/mysql )
50+ - [ Mariadb ] ( https://hub.docker.com/_/mariadb ) [ Mysql ] ( https://hub.docker.com/_/mysql )
4951- [ redis] ( https://hub.docker.com/_/redis )
5052- [ backup] ( https://hub.docker.com/r/offen/docker-volume-backup )
5153
@@ -64,8 +66,10 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
6466#### Contents:
6567
6668- [ Auto Configuration and Installation] ( #automatic )
67- - [ Requirements] ( #requirements )
6869- [ Manual Configuration and Installation] ( #manual )
70+ - [Requirements](#requirements)
71+ - [Configuration](#configuration)
72+ - [Installation](#installation)
6973- [ Portainer Installation] ( #portainer )
7074- [ Usage] ( #usage )
7175- [Website](#website)
@@ -75,9 +79,9 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
7579- [phpMyAdmin](#phpmyadmin)
7680- [backup](#backup)
7781
78- ## Automatic
82+ ### Automatic
7983
80- ### Exec install shell script for auto installation and configuration
84+ #### Exec install shell script for auto installation and configuration
8185
8286download with
8387
@@ -93,7 +97,9 @@ chmod +x install.sh
9397./install.sh
9498```
9599
96- ## Requirements
100+ ### Manual
101+
102+ #### Requirements
97103
98104Make sure you have the latest versions of ** Docker** and ** Docker Compose** installed on your machine and require up to 2 GB of RAM.
99105
@@ -104,9 +110,7 @@ Clone this repository or copy the files from this repository into a new folder.
104110
105111Make sure to [ add your user to the ` docker ` group] ( https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user ) .
106112
107- ## Manual
108-
109- ### Configuration
113+ #### Configuration
110114
111115download with
112116
@@ -126,39 +130,88 @@ Copy the example environment into `.env`
126130cp env.example .env
127131```
128132
129- Edit the ` .env ` file to change values of ``` LOCAL_TIMEZONE ``` , ``` DOMAIN_NAME ``` , ``` DIRECTORY_PATH ``` , ``` LETSENCRYPT_EMAIL ``` , ``` DB_USER ``` , ``` DB_PASSWORD ``` , ``` DB_NAME ``` , ``` MYSQL_ROOT_PASSWORD ``` , ``` DATABASE_IMAGE_NAME ``` , ``` DATABASE_CONT_NAME ``` , ``` DATABASE_PACKAGE_MANAGER ``` , ``` DATABASE_ADMIN_COMMANDLINE ``` , ``` PMA_CONTROLUSER ``` , ``` PMA_CONTROLPASS ``` , ``` PMA_HTPASSWD_USERNAME ``` , ``` PMA_HTPASSWD_PASSWORD ``` and ``` SSL_SNIPPET ``` .
130-
131- LOCAL_TIMEZONE=[ to see local timezones] ( https://docs.diladele.com/docker/timezones.html )
132-
133- DIRECTORY_PATH=``` pwd ``` at command line\
134- DATABASE_IMAGE_NAME=``` mariadb ``` or ``` mysql ``` \
135- DATABASE_CONT_NAME=``` mariadb ``` , ``` mysql ``` or ``` custom name ``` \
136- DATABASE_PACKAGE_MANAGER=``` apt-get update && apt-get install -y gettext-base ``` for mariadb, ``` microdnf install -y gettext ``` for mysql\
137- DATABASE_ADMIN_COMMANDLINE=``` mariadb-admin ``` for mariadb, ``` mysqladmin ``` for mysql\
138- SSL_SNIPPET=``` echo 'Generated Self-signed SSL Certificate at localhost' ``` for localhost\
139- SSL_SNIPPET=``` certbot certonly --webroot --webroot-path /tmp/acme-challenge --rsa-key-size 4096 --non-interactive --agree-tos --no-eff-email --force-renewal --email ${LETSENCRYPT_EMAIL} -d ${DOMAIN_NAME} -d www.${DOMAIN_NAME} ``` for remotehost
133+ Edit the ` .env ` file to change values of
134+
135+ | ``` LOCAL_TIMEZONE ``` | ``` DOMAIN_NAME ``` | ``` DIRECTORY_PATH ``` | ``` LETSENCRYPT_EMAIL ``` |
136+ | ``` DB_USER ``` | ``` DB_PASSWORD ``` | ``` DB_NAME ``` | ``` MYSQL_ROOT_PASSWORD ``` | ``` DATABASE_IMAGE_NAME ``` |
137+ | ``` DATABASE_CONT_NAME ``` | ``` DATABASE_PACKAGE_MANAGER ``` | ``` DATABASE_ADMIN_COMMANDLINE ``` | ``` PMA_CONTROLUSER ``` | ``` PMA_CONTROLPASS ``` |
138+ | ``` PMA_HTPASSWD_USERNAME ``` | ``` PMA_HTPASSWD_PASSWORD ``` | ``` SSL_SNIPPET ``` |
139+
140+ <table ><thead >
141+ <tr >
142+ <th>Variable </th>
143+ <th colspan="2">Value</th>
144+ </tr ></thead >
145+ <tbody >
146+ <tr >
147+ <td><code>LOCAL_TIMEZONE</code></td>
148+ <td colspan="2"><code><a href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List" rel="nofollow">to see local timezones</a></code></td>
149+ </tr >
150+ <tr >
151+ <td><code>DIRECTORY_PATH</code></td>
152+ <td colspan="2"><code>pwd</code> at command line</td>
153+ </tr >
154+ <tr >
155+ <td><code>DATABASE_IMAGE_NAME</code></td>
156+ <td colspan="2"><code>mariadb</code> or <code>mysql</code></td>
157+ </tr >
158+ <tr >
159+ <td><code>DATABASE_CONT_NAME</code></td>
160+ <td colspan="2"><code>mariadb</code>, <code>mysql</code> or <code>custom name</code></td>
161+ </tr >
162+ <tr >
163+ <td rowspan="2"><code>DATABASE_PACKAGE_MANAGER</code></td>
164+ <td>mariadb</td>
165+ <td><code>apt-get update && apt-get install -y gettext-base</code></td>
166+ </tr >
167+ <tr >
168+ <td>mysql</td>
169+ <td><code>microdnf install -y gettext</code></td>
170+ </tr >
171+ <tr >
172+ <td rowspan="2"><code>DATABASE_ADMIN_COMMANDLINE</code></td>
173+ <td>mariadb</td>
174+ <td><code>mariadb-admin</code></td>
175+ </tr >
176+ <tr >
177+ <td>mysql</td>
178+ <td><code>mysqladmin</code></td>
179+ </tr >
180+ <tr >
181+ <td rowspan="2"><code>SSL_SNIPPET</code></td>
182+ <td>localhost</td>
183+ <td><code>echo 'Generated Self-signed SSL Certificate at localhost'</code></td>
184+ </tr >
185+ <tr >
186+ <td>remotehost</td>
187+ <td><code>certbot certonly --webroot --webroot-path /tmp/acme-challenge --rsa-key-size 4096 --non-interactive --agree-tos --no-eff-email --force-renewal --email ${LETSENCRYPT_EMAIL} -d ${DOMAIN_NAME} -d www.${DOMAIN_NAME} -d ${SUBDOMAIN}.${DOMAIN_NAME}</code></td>
188+ </tr >
189+ </tbody >
190+ </table >
140191
141192and
142193
143194```
144195cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apache2/sites-available/default-ssl.conf
145196```
197+
146198change example.com to your domain name in ``` ./phpmyadmin/apache2/sites-available/default-ssl.conf ``` file.
147199
148200```
149201cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
150202```
203+
151204change pma_controluser and db_authentication_password in ``` ./database/phpmyadmin/sql/create_tables.sql.template ``` file.
152205
153- ### Installation
206+ #### Installation
154207
155208Firstly: will create external volume
156209
157210```
158211docker volume create --driver local --opt type=none --opt device=${PWD}/certbot --opt o=bind certbot-etc
159212```
160213
161- for localhost ssl: Generate Self-signed SSL Certificate with guide [ mkcert repository] ( https://github.com/FiloSottile/mkcert ) .
214+ Localhost ssl: Generate Self-signed SSL Certificate with guide [ mkcert repository] ( https://github.com/FiloSottile/mkcert ) .
162215
163216```
164217docker compose up -d
@@ -174,7 +227,7 @@ The containers are now built and running. You should be able to access the CakeP
174227
175228For convenience you may add a new entry into your hosts file.
176229
177- ## Portainer
230+ ### Portainer
178231
179232```
180233docker compose -f portainer-docker-compose.yml -p portainer up -d
@@ -184,99 +237,73 @@ manage docker with [Portainer](https://www.portainer.io/) is the definitive cont
184237
185238You can also visit ` https://example.com:9001 ` to access portainer after starting the containers.
186239
187- ## Usage
240+ ### Usage
188241
189242#### You could manage docker containers without command line with portainer.
190243
191- ### Show both running and stopped containers
192-
193- The docker ps command only shows running containers by default. To see all containers, use the -a (or --all) flag:
244+ #### Here’s a quick reference of commonly used Docker Compose commands
194245
195246```
196- docker ps -a
247+ docker ps -a# Lists all containers managed by the compose file
197248```
198249
199- ### Starting containers
200-
201- You can start the containers with the ` up ` command in daemon mode (by adding ` -d ` as an argument) or by using the ` start ` command:
202-
203250```
204- docker compose start
251+ docker compose start# Starts previously stopped containers
205252```
206253
207- ### Stopping containers
208-
209254```
210- docker compose stop
255+ docker compose stop# Stops all running containers
211256```
212257
213- ### Removing containers
214-
215- To stop and remove all the containers use the ` down ` command:
216-
217258```
218- docker compose down
259+ docker compose down# Stops and removes containers, networks, etc.
219260```
220261
221- to remove portainer and the other containers:
222-
223262```
224- docker rm -f $(docker ps -a -q)
263+ docker compose down -v # Add --volumes to remove volumes explicitly
225264```
226265
227- Use ` -v ` if you need to remove the database volume which is used to persist the database:
228-
229266```
230- docker compose down -v
267+ docker rm -f $(docker ps -a -q) # Removes portainer and the other containers
231268```
232269
233- to remove external certbot-etc and portainer and the other volumes:
234-
235270```
236- docker volume rm $(docker volume ls -q)
271+ docker volume rm $(docker volume ls -q)# Removes all volumes
237272```
238273
239- Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
240-
241274```
242- docker system prune
275+ docker network prune# Remove all unused networks
243276```
244277
245- To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
246-
247278```
248- docker system prune -a
279+ docker system prune# Removes unused data (containers, networks, images, and optionally volumes)
249280```
250281
251- to remove portainer and the other images:
252-
253282```
254- docker rmi $(docker image ls -q)
283+ docker system prune -a # Removes all unused images, not just dangling ones
255284```
256285
257- ### Logs containers
258-
259- To fetch the logs of a container.
286+ ```
287+ docker rmi $(docker image ls -q) # Removes portainer and the other images
288+ ```
260289
261290```
262- docker container logs container_name_or_id
291+ docker container logs container_name_or_id# Shows logs from all services
263292```
264293
265- ### Project from existing source
294+ #### Project from existing source
266295
267296Copy all files into a new directory:
268297
269- You can now use the ` up ` command:
270-
271298```
272- docker compose up -d
299+ docker compose up -d# Starts services in detached mode (in the background)
273300```
274301
275- ### Docker run reference
302+ #### Docker run reference
276303
277- [ https://docs.docker.com/engine/ reference/run/ ] ( https://docs.docker.com/engine/ reference/run / )
304+ [ https://docs.docker.com/reference/cli/docker/compose/ ] ( https://docs.docker.com/reference/cli/docker/compose / )
278305
279- ### Website
306+ #### Website
280307
281308You should see the "Welcome to CakePHP..." page in your browser. If not, please check if your PHP installation satisfies CakePHP's requirements.
282309
@@ -357,15 +384,15 @@ modify redis cache configuration values in the ```./cakephp/config/app_local.php
357384],
358385```
359386
360- ### DebugKit
387+ #### DebugKit
361388
362389[ book.cakephp.org/debugkit/5/en/index.html#configuration] ( https://book.cakephp.org/debugkit/5/en/index.html#configuration )
363390
364391If debugkit not showing and get error "This request has been blocked; the content must be served over HTTPS"
365392
366393add code snippet ``` <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> ``` in the ``` ./cakephp/templates/Pages/home.php ``` file.
367394
368- ### phpMyAdmin
395+ #### phpMyAdmin
369396
370397You can add your own custom config.inc.php settings (such as Configuration Storage setup) by creating a file named config.user.inc.php with the various user defined settings in it, and then linking it into the container using:
371398
@@ -377,10 +404,10 @@ You can also visit `https://example.com:9090` to access phpMyAdmin after startin
377404
378405The first authorize screen(htpasswd;username or password) and phpmyadmin login screen the username and the password is the same as supplied in the ` .env ` file.
379406
380- ### backup
407+ #### backup
381408
382409This will back up the all files and folders in database/dump sql and html volumes, once per day, and write it to ./backups with a filename like backup-2023-01-01T10-18-00.tar.gz
383410
384- #### can run on a custom cron schedule
411+ ##### can run on a custom cron schedule
385412
386413``` BACKUP_CRON_EXPRESSION: '20 01 * * *' ``` the UTC timezone.
0 commit comments