Skip to content

Commit af3a97a

Browse files
committed
Improve documentation and domain handling scripts
Expanded and clarified the README with improved formatting, updated instructions, and more detailed environment variable explanations. Updated docker-compose.yml to include 'git' in package installation and improved timezone configuration logic. Refined install.sh for better domain/host handling and updated timezone documentation links. Commented out ssl_stapling in nginx SSL options for compatibility.
1 parent 993bbd5 commit af3a97a

File tree

4 files changed

+140
-91
lines changed

4 files changed

+140
-91
lines changed

README.md

Lines changed: 118 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
If You want to build a website with Laravel at short time;
44

55
#### Full stack Apache2 Laravel:
6-
<p align="left"> <a href="https://laravel.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/958072?s=200&v=4" alt="Laravel" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
6+
<p align="left">
7+
<a href="https://laravel.com/" target="_blank" rel="noreferrer"> <img src="https://avatars.githubusercontent.com/u/958072?s=200&v=4" alt="Laravel" height="40" width="40"/> </a>&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;
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>&nbsp;&nbsp;&nbsp;
@@ -15,7 +16,8 @@ If You want to build a website with Laravel at short time;
1516
<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;
1617
<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;
1718
<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>
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>
20+
</p>
1921

2022
Plus, manage docker containers with Portainer.
2123

@@ -26,15 +28,17 @@ Plus, manage docker containers with Portainer.
2628
<p align="left"> apk, dnf, yum, apt/apt-get, zypper, pacman </p>
2729

2830
#### 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;
31+
<p align="left">
32+
<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;
3033
<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;
3134
<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;
3235
<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;
3336
<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;
3437
<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;
3538
<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;
3639
<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;
37-
<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+
<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>
41+
</p>
3842

3943
##### Note: Fedora 37, 39 and alpine linux x86-64 compatible, could not try sles IBM Z s390x, rhel IBM Z s390x and raspberrypi.
4044

@@ -44,7 +48,7 @@ Plus, manage docker containers with Portainer.
4448
- [webserver (apache2/httpd)](https://hub.docker.com/_/httpd)
4549
- [certbot (letsencrypt)](https://hub.docker.com/r/certbot/certbot)
4650
- [phpMyAdmin](https://hub.docker.com/r/phpmyadmin/phpmyadmin/)
47-
- [databaseMariadb](https://hub.docker.com/_/mariadb) [databaseMysql](https://hub.docker.com/_/mysql)
51+
- [Mariadb](https://hub.docker.com/_/mariadb) [Mysql](https://hub.docker.com/_/mysql)
4852
- [redis](https://hub.docker.com/_/redis)
4953
- [backup](https://hub.docker.com/r/offen/docker-volume-backup)
5054

@@ -63,8 +67,10 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
6367
#### Contents:
6468

6569
- [Auto Configuration and Installation](#automatic)
66-
- [Requirements](#requirements)
6770
- [Manual Configuration and Installation](#manual)
71+
- [Requirements](#requirements)
72+
- [Configuration](#configuration)
73+
- [Installation](#installation)
6874
- [Portainer Installation](#portainer)
6975
- [Usage](#usage)
7076
- [Website](#website)
@@ -75,9 +81,9 @@ Create rules to open ports to the internet, or to a specific IPv4 address or ran
7581
- [phpMyAdmin](#phpmyadmin)
7682
- [backup](#backup)
7783

78-
## Automatic
84+
### Automatic
7985

80-
### Exec install shell script for auto installation and configuration
86+
#### Exec install shell script for auto installation and configuration
8187

8288
download with
8389

@@ -93,7 +99,9 @@ chmod +x install.sh
9399
./install.sh
94100
```
95101

96-
## Requirements
102+
### Manual
103+
104+
#### Requirements
97105

98106
Make sure you have the latest versions of **Docker** and **Docker Compose** installed on your machine.
99107

@@ -104,9 +112,7 @@ Clone this repository or copy the files from this repository into a new folder.
104112

105113
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).
106114

107-
## Manual
108-
109-
### Configuration
115+
#### Configuration
110116

111117
download with
112118

@@ -126,40 +132,94 @@ Copy the example environment into `.env`
126132
cp env.example .env
127133
```
128134

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``` and ```PMA_HTPASSWD_PASSWORD```.
135+
Edit the `.env` file to change values of
136+
137+
|```LOCAL_TIMEZONE```|```DOMAIN_NAME```|```DIRECTORY_PATH```|```LETSENCRYPT_EMAIL```|
138+
|```DB_USER```|```DB_PASSWORD```|```DB_NAME```|```MYSQL_ROOT_PASSWORD```|```DATABASE_IMAGE_NAME```|
139+
|```DATABASE_CONT_NAME```|```DATABASE_PACKAGE_MANAGER```|```DATABASE_ADMIN_COMMANDLINE```|```PMA_CONTROLUSER```|```PMA_CONTROLPASS```|
140+
|```PMA_HTPASSWD_USERNAME```|```PMA_HTPASSWD_PASSWORD```|```SSL_SNIPPET```|
141+
142+
<table><thead>
143+
<tr>
144+
<th>Variable </th>
145+
<th colspan="2">Value</th>
146+
</tr></thead>
147+
<tbody>
148+
<tr>
149+
<td><code>LOCAL_TIMEZONE</code></td>
150+
<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>
151+
</tr>
152+
<tr>
153+
<td><code>DIRECTORY_PATH</code></td>
154+
<td colspan="2"><code>pwd</code> at command line</td>
155+
</tr>
156+
<tr>
157+
<td><code>DATABASE_IMAGE_NAME</code></td>
158+
<td colspan="2"><code>mariadb</code> or <code>mysql</code></td>
159+
</tr>
160+
<tr>
161+
<td><code>DATABASE_CONT_NAME</code></td>
162+
<td colspan="2"><code>mariadb</code>, <code>mysql</code> or <code><a href="https://docs.docker.com/reference/compose-file/services/#container_name" rel="nofollow" alt="custom name">custom name</a></code></td>
163+
</tr>
164+
<tr>
165+
<td rowspan="2"><code>DATABASE_PACKAGE_MANAGER</code></td>
166+
<td>mariadb</td>
167+
<td><code>apt-get update && apt-get install -y gettext-base</code></td>
168+
</tr>
169+
<tr>
170+
<td>mysql</td>
171+
<td><code>microdnf install -y gettext</code></td>
172+
</tr>
173+
<tr>
174+
<td rowspan="2"><code>DATABASE_ADMIN_COMMANDLINE</code></td>
175+
<td>mariadb</td>
176+
<td><code>mariadb-admin</code></td>
177+
</tr>
178+
<tr>
179+
<td>mysql</td>
180+
<td><code>mysqladmin</code></td>
181+
</tr>
182+
<tr>
183+
<td rowspan="2"><code>SSL_SNIPPET</code></td>
184+
<td>localhost</td>
185+
<td><code>echo 'Generated Self-signed SSL Certificate at localhost'</code></td>
186+
</tr>
187+
<tr>
188+
<td>remotehost</td>
189+
<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}</code></td>
190+
</tr>
191+
</tbody>
192+
</table>
130193

131-
LOCAL_TIMEZONE=[to see local timezones](https://docs.diladele.com/docker/timezones.html)
194+
and
132195

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-
VARNISH_VERSION=```latest``` for centos version 9+ and fedora, ```stable``` for the others\
139-
SSL_SNIPPET=```echo 'Generated Self-signed SSL Certificate for localhost'``` for localhost\
140-
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
196+
```
197+
cp ./webserver/extra/httpd-ssl.conf.template ./webserver/extra/httpd-ssl.conf
198+
```
141199

142-
and
200+
change example.com to your domain name in ```./webserver/extra/httpd-ssl.conf``` file.
143201

144202
```
145203
cp ./phpmyadmin/apache2/sites-available/default-ssl.sample.conf ./phpmyadmin/apache2/sites-available/default-ssl.conf
146204
```
205+
147206
change example.com to your domain name in ```./phpmyadmin/apache2/sites-available/default-ssl.conf``` file.
148207

149208
```
150209
cp ./database/phpmyadmin/sql/create_tables.sql.template.example ./database/phpmyadmin/sql/create_tables.sql.template
151210
```
211+
152212
change pma_controluser and db_authentication_password in ```./database/phpmyadmin/sql/create_tables.sql.template``` file.
153213

154-
### Installation
214+
#### Installation
155215

156216
Firstly: will create external volume
157217

158218
```
159219
docker volume create --driver local --opt type=none --opt device=${PWD}/certbot --opt o=bind certbot-etc
160220
```
161221

162-
for localhost ssl: Generate Self-signed SSL Certificate with guide [mkcert repository](https://github.com/FiloSottile/mkcert).
222+
Localhost ssl: Generate Self-signed SSL Certificate with guide [mkcert repository](https://github.com/FiloSottile/mkcert).
163223

164224
```
165225
docker compose up -d
@@ -175,7 +235,7 @@ The containers are now built and running. You should be able to access the Larav
175235

176236
For convenience you may add a new entry into your hosts file.
177237

178-
## Portainer
238+
### Portainer
179239

180240
```
181241
docker compose -f portainer-docker-compose.yml -p portainer up -d
@@ -185,91 +245,73 @@ manage docker with [Portainer](https://www.portainer.io/) is the definitive cont
185245

186246
You can also visit `https://example.com:9001` to access portainer after starting the containers.
187247

188-
## Usage
248+
### Usage
189249

190250
#### You could manage docker containers without command line with portainer.
191251

192-
### Show both running and stopped containers
193-
194-
The docker ps command only shows running containers by default. To see all containers, use the -a (or --all) flag:
252+
#### Here’s a quick reference of commonly used Docker Compose commands
195253

196254
```
197-
docker ps -a
255+
docker ps -a # Lists all containers managed by the compose file
198256
```
199257

200-
### Starting containers
201-
202-
You can start the containers with the `up` command in daemon mode (by adding `-d` as an argument) or by using the `start` command:
203-
204258
```
205-
docker compose start
259+
docker compose start # Starts previously stopped containers
206260
```
207261

208-
### Stopping containers
209-
210262
```
211-
docker compose stop
263+
docker compose stop # Stops all running containers
212264
```
213265

214-
### Removing containers
215-
216-
To stop and remove all the containers use the `down` command:
217-
218266
```
219-
docker compose down
267+
docker compose down # Stops and removes containers, networks, etc.
220268
```
221269

222-
to remove portainer and the other containers:
223-
224270
```
225-
docker rm -f $(docker ps -a -q)
271+
docker compose down -v # Add --volumes to remove volumes explicitly
226272
```
227273

228-
Use `-v` if you need to remove the database volume which is used to persist the database:
229-
230274
```
231-
docker compose down -v
275+
docker rm -f $(docker ps -a -q) # Removes portainer and the other containers
232276
```
233277

234-
to remove external certbot-etc and portainer and the other volumes:
235-
236278
```
237-
docker volume rm $(docker volume ls -q)
279+
docker volume rm $(docker volume ls -q) # Removes all volumes
238280
```
239281

240-
Delete all images, containers, volumes, and networks that are not associated with a container (dangling):
241-
242282
```
243-
docker system prune
283+
docker network prune # Remove all unused networks
244284
```
245285

246-
To additionally remove any stopped containers and all unused images (not just dangling ones), add the -a flag to the command:
286+
```
287+
docker system prune # Removes unused data (containers, networks, images, and optionally volumes)
288+
```
247289

248290
```
249-
docker system prune -a
291+
docker system prune -a # Removes all unused images, not just dangling ones
250292
```
251293

252-
to remove portainer and the other images:
294+
```
295+
docker rmi $(docker image ls -q) # Removes portainer and the other images
296+
```
253297

254298
```
255-
docker rmi $(docker image ls -q)
299+
docker container logs container_name_or_id # Shows logs from all services
256300
```
257301

258-
### Project from existing source
302+
#### Project from existing source
259303

260304
Copy all files into a new directory:
261305

262-
You can now use the `up` command:
263-
264306
```
265-
docker compose up -d
307+
docker compose up -d # Starts services in detached mode (in the background)
266308
```
267309

268-
### Docker run reference
310+
#### Docker run reference
269311

270-
[https://docs.docker.com/engine/reference/run/](https://docs.docker.com/engine/reference/run/)
312+
[https://docs.docker.com/reference/cli/docker/compose/](https://docs.docker.com/reference/cli/docker/compose/)
271313

272-
### Website
314+
#### Website
273315

274316
You should see the "Laravel" page in your browser. If not, please check if your PHP installation satisfies Laravel's requirements.
275317

@@ -291,7 +333,7 @@ docker container restart laravel
291333

292334
Many important configuration values are defined using the ```./laravel/.env``` file that exists at the root of your application.
293335

294-
[https://laravel.com/docs/9.x#environment-based-configuration](https://laravel.com/docs/9.x#environment-based-configuration)
336+
[https://laravel.com/docs/12.x/installation#environment-based-configuration](https://laravel.com/docs/12.x/installation#environment-based-configuration)
295337

296338
add and/or remove laravel site folders and files with any ftp client program in ```./laravel``` folder.
297339
<br />You can also visit `https://example.com` to access website after starting the containers.
@@ -306,25 +348,25 @@ add or remove code in the ```./webserver/extra/httpd-ssl.conf``` file for custom
306348

307349
The configuration for Laravel's database services is located in your application's config/database.php configuration file.
308350

309-
[https://laravel.com/docs/9.x/database](https://laravel.com/docs/9.x/database)
351+
[https://laravel.com/docs/12.x/database](https://laravel.com/docs/12.x/database)
310352

311353
[https://mariadb.com/kb/en/configuring-mariadb-with-option-files/](https://mariadb.com/kb/en/configuring-mariadb-with-option-files/)
312354

313-
[https://dev.mysql.com/doc/refman/8.3/en/](https://dev.mysql.com/doc/refman/8.3/en/)
355+
[https://dev.mysql.com/doc/](https://dev.mysql.com/doc/)
314356

315357
#### Redis
316358

317359
You may configure your application's Redis settings via the config/database.php configuration file.
318360

319-
[https://laravel.com/docs/9.x/redis](https://laravel.com/docs/9.x/redis)
361+
[https://laravel.com/docs/12.x/redis](https://laravel.com/docs/12.x/redis)
320362

321363
#### Cache
322364

323365
Your application's cache configuration file is located at config/cache.php.
324366

325-
[https://laravel.com/docs/9.x/cache#main-content](https://laravel.com/docs/9.x/cache#main-content)
367+
[https://laravel.com/docs/12.x/cache](https://laravel.com/docs/12.x/cache)
326368

327-
### phpMyAdmin
369+
#### phpMyAdmin
328370

329371
You 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:
330372

@@ -336,10 +378,10 @@ You can also visit `https://example.com:9090` to access phpMyAdmin after startin
336378

337379
The 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.
338380

339-
### backup
381+
#### backup
340382

341-
This 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
383+
This 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
342384

343-
#### can run on a custom cron schedule
385+
##### can run on a custom cron schedule
344386

345387
```BACKUP_CRON_EXPRESSION: '20 01 * * *'``` the UTC timezone.

0 commit comments

Comments
 (0)