Skip to content

Commit 06b98d2

Browse files
committed
added localhost and remotehost options and support arch linux(pacman package manager)
1 parent fedd011 commit 06b98d2

File tree

4 files changed

+517
-110
lines changed

4 files changed

+517
-110
lines changed

README.md

Lines changed: 135 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
11
# [full stack proxy nginx CakePHP for everyone with docker compose](https://github.com/damalis/full-stack-proxy-nginx-cakephp-for-everyone-with-docker-compose)
22

3-
If You want to build a reverse proxy website with CakePHP "basic" at short time;
3+
If You want to build a reverse proxy website with CakePHP "basic" at short time;
44

55
#### Full stack Proxy Nginx CakePHP "basic":
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>&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp; <a href="https://www.nginx.com" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1412239?s=200&v=4" alt="nginx" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <a href="https://www.php.net" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/25158?s=200&v=4" alt="php" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <a href="https://redis.io" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1529926?s=200&v=4" alt="redis" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <a href="#" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/80688e429a7d4ef2fca1e82350fe8e3517d3494d/topics/bash/bash.png" alt="Bash" height="50" width="50" /> </a>&nbsp;&nbsp;&nbsp;
7-
<a href="https://www.phpmyadmin.net/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1351977?s=200&v=4" alt="phpmyadmin" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <a href="https://www.apache.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/47359?s=200&v=4" alt="apache" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <a href="https://letsencrypt.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/17889013?s=200&v=4" alt="letsencrypt" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp; <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>&nbsp;&nbsp;&nbsp; <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>
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>&nbsp;&nbsp;&nbsp;
7+
<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>&nbsp;&nbsp;&nbsp;
8+
<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>&nbsp;&nbsp;&nbsp;
9+
<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>&nbsp;&nbsp;&nbsp;
10+
<a href="https://www.nginx.com" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1412239?s=200&v=4" alt="nginx" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
11+
<a href="https://www.php.net" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/25158?s=200&v=4" alt="php" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
12+
<a href="https://redis.io" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1529926?s=200&v=4" alt="redis" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
13+
<a href="https://www.phpmyadmin.net/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1351977?s=200&v=4" alt="phpmyadmin" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
14+
<a href="https://www.apache.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/47359?s=200&v=4" alt="apache" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
15+
<a href="https://letsencrypt.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/17889013?s=200&v=4" alt="letsencrypt" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
16+
<a href="https://certbot.eff.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/17889013?s=200&v=4" alt="certbot" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
17+
<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>&nbsp;&nbsp;&nbsp;
18+
<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>&nbsp;&nbsp;&nbsp;
19+
<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>&nbsp;&nbsp;&nbsp;
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> </p>
821

922
Plus, manage docker containers with Portainer.
1023

24+
#### Supported CPU architectures:
25+
<p align="left"> arm64/aarch64, x86-64 </p>
26+
27+
#### Supported Linux Package Manage Systems:
28+
<p align="left"> apk, dnf, yum, apt/apt-get, zypper, pacman </p>
29+
30+
#### Supported Linux Operation Systems:
31+
<p align="left"> <a href="https://alpinelinux.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/7600810?s=200&v=4" alt="alpine linux" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
32+
<a href="https://fedoraproject.org/" target="_blank" rel="noreferrer"> <img src="https://raw.githubusercontent.com/github/explore/e6b1e7f0fb8d0bf920bd719c7289243138bdc1b4/topics/fedora/fedora.png" alt="fedora" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
33+
<a href="https://www.centos.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/79192?s=200&v=4" alt="centos" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
34+
<a href="https://www.debian.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1854028?s=200&v=4" alt="debian" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
35+
<a href="https://ubuntu.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/4604537?s=200&v=4" alt="ubuntu" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
36+
<a href="https://www.raspberrypi.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/1294177?s=200&v=4" alt="ubuntu" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
37+
<a href="https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/33972111?s=200&v=4" alt="redhat on s390x (IBM Z)" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
38+
<a href="https://www.suse.com/products/server/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/623819?s=200&v=4" alt="opensuse on s390x (IBM Z)" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
39+
<a href="https://archlinux.org/" target="_blank" rel="noreferrer"> <img src="https://gitlab.archlinux.org/uploads/-/system/group/avatar/23/iconfinder_archlinux_386451.png?width=48" alt="arch linux" height="40" width="40"/> </a> </p>
40+
41+
##### Note: Fedora 37, 39 and alpine linux x86-64 compatible, could not try sles IBM Z s390x, rhel IBM Z s390x and raspberrypi.
42+
1143
#### With this project you can quickly run the following:
1244

1345
- [CakePHP](https://github.com/cakephp/app) - [php-fpm](https://hub.docker.com/_/php?tab=tags&page=1&name=fpm)
1446
- [webserver (apache2/httpd)](https://hub.docker.com/_/httpd)
1547
- [proxy (nginx)](https://hub.docker.com/_/nginx)
1648
- [certbot (letsencrypt)](https://hub.docker.com/r/certbot/certbot)
1749
- [phpMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/)
18-
- [database](https://hub.docker.com/_/mariadb)
50+
- [databaseMariadb](https://hub.docker.com/_/mariadb) [databaseMysql](https://hub.docker.com/_/mysql)
1951
- [redis](https://hub.docker.com/_/redis)
2052
- [backup](https://hub.docker.com/r/offen/docker-volume-backup)
2153

@@ -43,7 +75,7 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
4375
- [Webserver](#webserver)
4476
- [Redis](#redis)
4577
- [phpMyAdmin](#phpmyadmin)
46-
- [backup](#backup)
78+
- [backup](#backup)
4779

4880
## Automatic
4981

@@ -65,12 +97,12 @@ chmod +x install.sh
6597

6698
## Requirements
6799

68-
Make sure you have the latest versions of **Docker** and **Docker Compose** installed on your machine.
100+
Make sure you have the latest versions of **Docker** and **Docker Compose** installed on your machine and require up to 2 GB of RAM.
69101

70102
- [How install docker](https://docs.docker.com/engine/install/)
71103
- [How install docker compose](https://docs.docker.com/compose/install/)
72104

73-
Clone this repository or copy the files from this repository into a new folder. In the **docker-compose.yml** file you may change the database from MariaDB to MySQL.
105+
Clone this repository or copy the files from this repository into a new folder.
74106

75107
Make sure to [add your user to the `docker` group](https://docs.docker.com/install/linux/linux-postinstall/#manage-docker-as-a-non-root-user).
76108

@@ -79,6 +111,7 @@ Make sure to [add your user to the `docker` group](https://docs.docker.com/insta
79111
### Configuration
80112

81113
download with
114+
82115
```
83116
git clone https://github.com/damalis/full-stack-proxy-nginx-cakephp-for-everyone-with-docker-compose.git
84117
```
@@ -95,28 +128,40 @@ Copy the example environment into `.env`
95128
cp env.example .env
96129
```
97130

98-
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```, ```PMA_CONTROLUSER```, ```PMA_CONTROLPASS```, ```PMA_HTPASSWD_USERNAME``` and ```PMA_HTPASSWD_PASSWORD```.
131+
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```.
99132

100133
LOCAL_TIMEZONE=[to see local timezones](https://docs.diladele.com/docker/timezones.html)
101134

102-
DIRECTORY_PATH=```pwd``` at command line
135+
DIRECTORY_PATH=```pwd``` at command line\
136+
DATABASE_IMAGE_NAME=```mariadb``` or ```mysql```\
137+
DATABASE_CONT_NAME=```mariadb```, ```mysql``` or ```custom name```\
138+
DATABASE_PACKAGE_MANAGER=```apt-get update && apt-get install -y gettext-base``` for mariadb, ```microdnf install -y gettext``` for mysql\
139+
DATABASE_ADMIN_COMMANDLINE=```mariadb-admin``` for mariadb, ```mysqladmin``` for mysql\
140+
SSL_SNIPPET=```echo 'Generated Self-signed SSL Certificate at localhost'``` for localhost\
141+
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
103142

104143
and
105144

106145
```
107146
cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apache2/sites-available/default-ssl.conf
108147
```
109-
110148
change example.com to your domain name in ```./phpmyadmin/apache2/sites-available/default-ssl.conf``` file.
111149

150+
```
151+
cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
152+
```
153+
change pma_controluser and db_authentication_password in ```./database/phpmyadmin/sql/create_tables.sql.template``` file.
154+
112155
### Installation
113156

114157
Firstly: will create external volume
115158

116159
```
117-
docker volume create --driver local --opt type=none --opt device=${DIRECTORY_PATH}/certbot --opt o=bind certbot-etc
160+
docker volume create --driver local --opt type=none --opt device=${PWD}/certbot --opt o=bind certbot-etc
118161
```
119162

163+
for localhost ssl: Generate Self-signed SSL Certificate with guide [mkcert repository](https://github.com/FiloSottile/mkcert).
164+
120165
```
121166
docker compose up -d
122167
```
@@ -136,6 +181,7 @@ For convenience you may add a new entry into your hosts file.
136181
```
137182
docker compose -f portainer-docker-compose.yml -p portainer up -d
138183
```
184+
139185
manage docker with [Portainer](https://www.portainer.io/) is the definitive container management tool for Docker, Docker Swarm with it's highly intuitive GUI and API.
140186

141187
You can also visit `https://example.com:9001` to access portainer after starting the containers.
@@ -174,7 +220,8 @@ To stop and remove all the containers use the `down` command:
174220
docker compose down
175221
```
176222

177-
to remove portainer and the other containers
223+
to remove portainer and the other containers:
224+
178225
```
179226
docker rm -f $(docker ps -a -q)
180227
```
@@ -185,17 +232,38 @@ Use `-v` if you need to remove the database volume which is used to persist the
185232
docker compose down -v
186233
```
187234

188-
to remove external certbot-etc and portainer and the other volumes
235+
to remove external certbot-etc and portainer and the other volumes:
189236

190237
```
191238
docker volume rm $(docker volume ls -q)
192239
```
193240

194-
to remove portainer and the other images
241+
Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
242+
243+
```
244+
docker system prune
245+
```
246+
247+
To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
248+
249+
```
250+
docker system prune -a
251+
```
252+
253+
to remove portainer and the other images:
254+
195255
```
196256
docker rmi $(docker image ls -q)
197257
```
198258

259+
### Logs containers
260+
261+
To fetch the logs of a container.
262+
263+
```
264+
docker container logs container_name_or_id
265+
```
266+
199267
### Project from existing source
200268

201269
Copy all files into a new directory:
@@ -249,9 +317,59 @@ add or remove code in the ```./webserver/extra/httpd-vhosts.conf``` file for cus
249317

250318
#### Redis
251319

252-
see [Redis Cache](https://book.cakephp.org/4/en/core-libraries/caching.html#redisengine-options) options and must add below code to config file.
253-
254-
modify redis cache configuration values in the ```/app/basic/config/app_local.php``` file.
320+
see [Redis Cache](https://book.cakephp.org/5/en/core-libraries/caching.html#redisengine-options) options and must add below code to config file.
321+
322+
```
323+
/**
324+
* Configure the cache adapters.
325+
*/
326+
'Cache' => [
327+
'default' => [
328+
'className' => 'Redis',
329+
'path' => CACHE,
330+
'password' => false,
331+
'server' => 'redis',
332+
'port' => 6379,
333+
],
334+
335+
/**
336+
* Configure the cache used for general framework caching.
337+
* Translation cache files are stored with this configuration.
338+
*/
339+
'_cake_core_' => [
340+
'className' => 'Redis',
341+
'prefix' => 'myapp_cake_core_',
342+
'path' => CACHE . 'persistent/',
343+
'serialize' => true,
344+
'duration' => '+2 minutes',
345+
'server' => 'redis',
346+
'port' => 6379,
347+
'password' => false,
348+
],
349+
350+
/**
351+
* Configure the cache for model and datasource caches. This cache
352+
* configuration is used to store schema descriptions, and table listings
353+
* in connections.
354+
*/
355+
'_cake_model_' => [
356+
'className' => 'Redis',
357+
'prefix' => 'myapp_cake_model_',
358+
'path' => CACHE . 'models/',
359+
'serialize' => true,
360+
'duration' => '+2 minutes',
361+
'server' => 'redis',
362+
'port' => 6379,
363+
'password' => false,
364+
],
365+
],
366+
```
367+
368+
modify redis cache configuration values in the ```./cakephp/config/app_local.php``` file.
369+
370+
### DebugKit
371+
372+
[https://book.cakephp.org/debugkit/5/en/index.html#configuration](https://book.cakephp.org/debugkit/5/en/index.html#configuration)
255373

256374
### phpMyAdmin
257375

0 commit comments

Comments
 (0)