Skip to content

Commit ed8b958

Browse files
committed
improved some codes and syntaxes
1 parent 5e8756e commit ed8b958

File tree

7 files changed

+348
-84
lines changed

7 files changed

+348
-84
lines changed

README.md

Lines changed: 65 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,47 @@
33
If You want to build a website with CodeIgniter "appstarter" at short time;
44

55
#### Full stack Nginx CodeIgniter "appstarter":
6-
<p align="left"> <a href="https://www.codeigniter.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/44521256?s=200&v=4" alt="codeigniter" 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://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.codeigniter.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/44521256?s=200&v=4" alt="codeigniter" 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="#" 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;
14+
<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;
15+
<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;
16+
<a href="https://letsencrypt.org/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/9289019?s=200&v=4" alt="letsencrypt" 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://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>
819

920
Plus, manage docker containers with Portainer.
1021

22+
#### Supported CPU architectures:
23+
<p align="left"> arm64/aarch64, x86-64 </p>
24+
25+
#### Supported Linux Package Manage Systems:
26+
<p align="left"> apk, dnf, yum, apt/apt-get, zypper </p>
27+
28+
#### Supported Linux Operation Systems:
29+
<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;
30+
<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;
31+
<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;
32+
<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;
33+
<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;
34+
<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;
35+
<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;
36+
<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> </p>
37+
38+
##### Note: Fedora 37, 39 and alpine linux x86-64 compatible, could not try sles IBM Z s390x, rhel IBM Z s390x and raspberrypi.
39+
1140
#### With this project you can quickly run the following:
1241

1342
- [CodeIgniter](https://github.com/codeigniter4/CodeIgniter4) - [php-fpm](https://hub.docker.com/_/php?tab=tags&page=1&name=fpm)
1443
- [webserver (nginx)](https://hub.docker.com/_/nginx)
1544
- [certbot (letsencrypt)](https://hub.docker.com/r/certbot/certbot)
1645
- [phpMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/)
17-
- [database](https://hub.docker.com/_/mariadb)
46+
- [databaseMariadb](https://hub.docker.com/_/mariadb) [databaseMysql](https://hub.docker.com/_/mysql)
1847
- [redis](https://hub.docker.com/_/redis)
1948
- [backup](https://hub.docker.com/r/offen/docker-volume-backup)
2049

@@ -69,15 +98,16 @@ Make sure you have the latest versions of **Docker** and **Docker Compose** inst
6998
- [How install docker](https://docs.docker.com/engine/install/)
7099
- [How install docker compose](https://docs.docker.com/compose/install/)
71100

72-
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.
101+
Clone this repository or copy the files from this repository into a new folder.
73102

74103
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).
75104

76-
## Manual
105+
## Manual
77106

78107
### Configuration
79108

80109
download with
110+
81111
```
82112
git clone https://github.com/damalis/full-stack-nginx-codeigniter-for-everyone-with-docker-compose.git
83113
```
@@ -94,11 +124,15 @@ Copy the example environment into `.env`
94124
cp env.example .env
95125
```
96126

97-
Edit the `.env` file to change values of ```LOCAL_TIMEZONE```, ```DOMAIN_NAME```, ```DIRECTORY_PATH```, ```LETSENCRYPT_EMAIL```, ```DB_USER```, ```DB_PASSWORD```, ```DB_NAME```, ```DB_TABLE_PREFIX```, ```MYSQL_ROOT_PASSWORD```, ```PMA_CONTROLUSER```, ```PMA_CONTROLPASS```, ```PMA_HTPASSWD_USERNAME``` and ```PMA_HTPASSWD_PASSWORD```.
127+
Edit the `.env` file to change values of ```LOCAL_TIMEZONE```, ```DOMAIN_NAME```, ```DIRECTORY_PATH```, ```LETSENCRYPT_EMAIL```, ```DB_USER```, ```DB_PASSWORD```, ```DB_NAME```, ```DB_TABLE_PREFIX```, ```MYSQL_ROOT_PASSWORD```, ```DATABASE_IMAGE_NAME```, ```DATABASE_CONT_NAME```, ```DATABASE_PACKAGE_MANAGER```, ```DATABASE_ADMIN_COMMANDLINE```, ```PMA_CONTROLUSER```, ```PMA_CONTROLPASS```, ```PMA_HTPASSWD_USERNAME``` and ```PMA_HTPASSWD_PASSWORD```.
98128

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

101-
DIRECTORY_PATH=```pwd``` at command line
131+
DIRECTORY_PATH=```pwd``` at command line\
132+
DATABASE_IMAGE_NAME=```mariadb``` or ```mysql```\
133+
DATABASE_CONT_NAME=```mariadb```, ```mysql``` or ```custom name```\
134+
DATABASE_PACKAGE_MANAGER=```apt-get update && apt-get install -y gettext-base``` for mariadb, ```microdnf install -y gettext``` for mysql\
135+
DATABASE_ADMIN_COMMANDLINE=```mariadb-admin``` for mariadb, ```mysqladmin``` for mysql\
102136

103137
and
104138

@@ -108,12 +142,17 @@ cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apa
108142

109143
change example.com to your domain name in ```./phpmyadmin/apache2/sites-available/default-ssl.conf``` file.
110144

145+
```
146+
cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
147+
```
148+
change pma_controluser and db_authentication_password in ```./database/phpmyadmin/sql/create_tables.sql.template``` file.
149+
111150
### Installation
112151

113152
Firstly: will create external volume
114153

115154
```
116-
docker volume create --driver local --opt type=none --opt device=${DIRECTORY_PATH}/certbot --opt o=bind certbot-etc
155+
docker volume create --driver local --opt type=none --opt device=${PWD}/certbot --opt o=bind certbot-etc
117156
```
118157

119158
```
@@ -135,6 +174,7 @@ For convenience you may add a new entry into your hosts file.
135174
```
136175
docker compose -f portainer-docker-compose.yml -p portainer up -d
137176
```
177+
138178
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.
139179

140180
You can also visit `https://example.com:9001` to access portainer after starting the containers.
@@ -173,7 +213,8 @@ To stop and remove all the containers use the `down` command:
173213
docker compose down
174214
```
175215

176-
to remove portainer and the other containers
216+
to remove portainer and the other containers:
217+
177218
```
178219
docker rm -f $(docker ps -a -q)
179220
```
@@ -184,13 +225,26 @@ Use `-v` if you need to remove the database volume which is used to persist the
184225
docker compose down -v
185226
```
186227

187-
to remove external certbot-etc and portainer and the other volumes
228+
to remove external certbot-etc and portainer and the other volumes:
188229

189230
```
190231
docker volume rm $(docker volume ls -q)
191232
```
192233

193-
to remove portainer and the other images
234+
Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
235+
236+
```
237+
docker system prune
238+
```
239+
240+
To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
241+
242+
```
243+
docker system prune -a
244+
```
245+
246+
to remove portainer and the other images:
247+
194248
```
195249
docker rmi $(docker image ls -q)
196250
```

database/phpmyadmin/sql/create_tables.sql.template renamed to database/phpmyadmin/sql/create_tables.sql.template.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ USE phpmyadmin;
2626
--
2727
-- CREATE USER IF NOT EXISTS for phpmyadmin database
2828
--
29-
CREATE USER IF NOT EXISTS '$PMA_CONTROLUSER'@'%' IDENTIFIED VIA mysql_native_password USING PASSWORD('$PMA_CONTROLPASS');
29+
CREATE USER IF NOT EXISTS 'pma_controluser'@'%' IDENTIFIED BY 'db_authentication_password';
3030

3131
--
3232
-- Privileges
3333
--
3434
-- (activate this statement if necessary)
35-
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON `phpmyadmin`.* TO '$PMA_CONTROLUSER'@'%';
35+
GRANT SELECT, INSERT, DELETE, UPDATE, ALTER ON `phpmyadmin`.* TO 'pma_controluser'@'%';
3636

3737
-- --------------------------------------------------------
3838

@@ -356,4 +356,4 @@ CREATE TABLE IF NOT EXISTS `pma__export_templates` (
356356
UNIQUE KEY `u_user_type_template` (`username`,`export_type`,`template_name`)
357357
)
358358
COMMENT='Saved export templates'
359-
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;
359+
DEFAULT CHARACTER SET utf8 COLLATE utf8_bin;

0 commit comments

Comments
 (0)