Skip to content

Commit c3df56e

Browse files
authored
Merge pull request #10 from joglomedia/linux
v1.1.1 Suddenly
2 parents 7ff22ec + 79916a9 commit c3df56e

File tree

4 files changed

+123
-52
lines changed

4 files changed

+123
-52
lines changed

README.md

Lines changed: 60 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ Dockerize your PHP apps ;)
1414
Easydock comes with:
1515

1616
- Nginx
17-
- PHP (PHP-FPM 5.x, 7.x and 8.x)
18-
- MySQL (latest version of MariaDB)
17+
- PHP (7.4 and 8.0)
18+
- MariaDB (Drop-in replacement for MySQL)
19+
- PostgreSQL
1920
- Redis
2021
- ~~phpmyadmin~~ Adminer (Lightweight MySQL admin)
2122
- MailHog
@@ -25,7 +26,7 @@ Easydock comes with:
2526

2627
## Requirements
2728

28-
Docker and Docker Compose installed on Linux Distro (Debian, Ubuntu)
29+
Docker and Docker Compose installed on Linux Distro (Debian or Ubuntu).
2930

3031
## Installation
3132

@@ -40,58 +41,96 @@ easydock init && easydock import
4041

4142
- Configure your application path into `.env.easydock` file.
4243

43-
## Getting started
44+
## Getting Started
4445

45-
- After installation, if you need, configure your `.env.easydock` file and run:
46+
After installation completed, if required, you could configure your `.env.easydock` file and then run this build command:
4647

4748
```bash
4849
easydock build
4950
```
5051

51-
### Config your app DB connection (default)
52+
### Configure Nginx and PHP-FPM
53+
54+
- The default Nginx server configuration (app.conf) will expose your project `/public` folder.
55+
- If your project uses different directory structure, you should adjust the configuration and update the file accordingly.
56+
- Your application by default accessible through localhost on port 8008 (`http://localhost:8008`)
57+
- Supported PHP version: 7.4 & 8.0
58+
59+
```bash
60+
# APP PORT
61+
APP_PORT=8008
62+
63+
# PHP VERSION
64+
PHP_VERSION=7.4
65+
```
66+
67+
### Configure database connection
68+
69+
The default database connection for MySQL and PostgreSQL.
70+
71+
```bash
72+
Username: easydock
73+
Password: secret
74+
Database: easydockdb
75+
Host: mysql ( or postgres for PostgreSQL )
76+
```
77+
78+
For security reason, you should change the default database username and password configured in `.env.easydock` file.
5279

5380
```bash
54-
user: root
55-
pass: secret
56-
db: dockerdb
57-
host: mysql ( or redis for Redis )
81+
# MYSQL / POSTGRESQL DB NAME
82+
DB_NAME=easydockdb
83+
84+
# MYSQL / POSTGRESQL USER
85+
DB_USER=easydock
86+
87+
# MYSQL / POSTGRESQL USER PASSWORD
88+
DB_PASS=secret
89+
90+
# MYSQL ROOT PASSWORD
91+
DB_ROOT_PASS=rootsecret
92+
93+
# MYSQL PORT
94+
MYSQL_PORT=3306
95+
96+
# POSTGRESQL PORT
97+
POSTGRES_PORT=5432
5898
```
5999

60-
### Config your app SMTP conn (default - no user or pass are required)
100+
### Configure SMTP connection
101+
102+
By default, SMTP connection through MailHog doesn't require any username or password.
61103

62104
```bash
63105
host: mailhog
64106
port: 1025
65107
```
66108

67-
- The default Nginx config (app.conf) will expose your project `/public` folder.
68-
- If your project is using different directory structure, you should adjust the configurations and update the file accordingly.
69-
70-
### To start your Docker istance
109+
### To start your app instance
71110

72111
```bash
73112
easydock up
74113
```
75114

76-
### To stop your Docker istance
115+
### To stop your app instance
77116

78117
```bash
79118
easydock stop
80119
```
81120

82-
### To restart your Docker istance
121+
### To restart your app instance
83122

84123
```bash
85124
easydock restart
86125
```
87126

88-
### To stop and delete your Docker istance
127+
### To stop and delete your app instance
89128

90129
```bash
91130
easydock down
92131
```
93132

94-
### To "SSH" into your Docker istance
133+
### To "SSH" into your app instance
95134

96135
```bash
97136
easydock shell
@@ -103,7 +142,7 @@ easydock shell
103142
easydock info
104143
```
105144

106-
### You can reset your Docker istance running
145+
### You can reset your running instance
107146

108147
```bash
109148
easydock reset
@@ -115,7 +154,7 @@ easydock reset
115154
easydock reset && easydock build
116155
```
117156

118-
_*NB: Database data will be removed*_
157+
_*PS: Resetting your EasyDock instance will delete the database data*_
119158

120159
## Security Vulnerabilities and Bugs
121160

config/.env.easydock

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,23 @@ APP_PORT=8008
2222
# PHP VERSION
2323
PHP_VERSION=7.4
2424

25-
# MYSQL DB NAME
25+
# MYSQL / POSTGRESQL DB NAME
2626
DB_NAME=easydockdb
2727

28-
# MYSQL USER
28+
# MYSQL / POSTGRESQL USER
2929
DB_USER=easydock
3030

31-
# MYSQL USER PASSWORD
31+
# MYSQL / POSTGRESQL USER PASSWORD
3232
DB_PASS=secret
3333

3434
# MYSQL ROOT PASSWORD
3535
DB_ROOT_PASS=rootsecret
3636

37-
# MYSQL DB PORT
38-
DB_PORT=3306
37+
# MYSQL PORT
38+
MYSQL_PORT=3306
39+
40+
# POSTGRESQL PORT
41+
POSTGRES_PORT=5432
3942

4043
# REDIS PORT
4144
REDIS_PORT=6379

src/docker-compose.yml

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ services:
1717
SERVICE_NAME: webapp
1818
working_dir: /var/www
1919
volumes:
20-
- ${APP_DIR}/:/var/www/:cached
20+
- ${APP_DIR}:/var/www:cached
2121
- ${APP_DIR}/.easydock/config/php/php.ini:/usr/local/etc/php/conf.d/local.ini
2222
- ${APP_DIR}/.easydock/config/php/opcache.ini:/usr/local/etc/php/conf.d/opcache.ini
2323
- ${APP_DIR}/.easydock/config/php/zz-docker.conf:/usr/local/etc/php-fpm.d/zz-docker.conf
24-
- ${APP_DIR}/.easydock/log/php/:/var/log/php/
25-
# - phpsocket:/var/run/
24+
- ${APP_DIR}/.easydock/log/php:/var/log/php
25+
# - phpsocket:/var/run
2626
networks:
2727
- easydocknet
2828
# Nginx
@@ -36,10 +36,10 @@ services:
3636
depends_on:
3737
- webapp
3838
volumes:
39-
- ${APP_DIR}/:/var/www/:cached
40-
- ${APP_DIR}/.easydock/config/nginx/:/etc/nginx/conf.d/
41-
- ${APP_DIR}/.easydock/log/nginx/:/var/log/nginx/
42-
# - phpsocket:/var/run/
39+
- ${APP_DIR}:/var/www:cached
40+
- ${APP_DIR}/.easydock/config/nginx:/etc/nginx/conf.d
41+
- ${APP_DIR}/.easydock/log/nginx:/var/log/nginx
42+
# - phpsocket:/var/run
4343
networks:
4444
- easydocknet
4545
# MySQL (MariaDB)
@@ -53,11 +53,27 @@ services:
5353
MYSQL_PASSWORD: ${DB_PASS}
5454
MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS}
5555
ports:
56-
- ${DB_PORT}:3306
56+
- ${MYSQL_PORT}:3306
5757
command: ['--character-set-server=utf8mb4','--collation-server=utf8mb4_unicode_ci','--default-authentication-plugin=mysql_native_password']
5858
volumes:
59-
- ${APP_DIR}/.easydock/data:/var/lib/mysql/
60-
- ${APP_DIR}/.easydock/log/mysql/:/var/log/mysql/
59+
- ${APP_DIR}/.easydock/data/mysql:/var/lib/mysql
60+
- ${APP_DIR}/.easydock/log/mysql:/var/log/mysql
61+
networks:
62+
- easydocknet
63+
# PostgreSQL
64+
postgres:
65+
image: postgres:alpine
66+
container_name: ${APP_SID}_postgres
67+
restart: always
68+
environment:
69+
POSTGRES_USER: ${DB_USER}
70+
POSTGRES_PASSWORD: ${DB_PASS}
71+
POSTGRES_DB: ${DB_NAME}
72+
PGDATA: /var/lib/postgresql/data/pgdata
73+
ports:
74+
- ${POSTGRES_PORT}:5432
75+
volumes:
76+
- ${APP_DIR}/.easydock/data/postgres:/var/lib/postgresql/data
6177
networks:
6278
- easydocknet
6379
# Redis

src/easydock

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -250,30 +250,42 @@ function ed_portscheck() {
250250
else
251251
ed_unavailableport "${ed_portapp}"
252252
fi
253-
ed_checkingport "${ed_portdb}"
254-
if ed_isthisportfree "${ed_portdb}"; then
255-
ed_availableport "${ed_portdb}"
253+
254+
ed_checkingport "${ed_portmysql}"
255+
if ed_isthisportfree "${ed_portmysql}"; then
256+
ed_availableport "${ed_portmysql}"
257+
else
258+
ed_unavailableport "${ed_portmysql}"
259+
fi
260+
261+
ed_checkingport "${ed_portpgsql}"
262+
if ed_isthisportfree "${ed_portpgsql}"; then
263+
ed_availableport "${ed_portpgsql}"
264+
else
265+
ed_unavailableport "${ed_portpgsql}"
266+
fi
267+
268+
269+
ed_checkingport "${ed_portrds}"
270+
if ed_isthisportfree "${ed_portrds}"; then
271+
ed_availableport "${ed_portrds}"
256272
else
257-
ed_unavailableport "${ed_portdb}"
273+
ed_unavailableport "${ed_portrds}"
258274
fi
275+
259276
ed_checkingport "${ed_portpma}"
260277
if ed_isthisportfree "${ed_portpma}"; then
261278
ed_availableport "${ed_portpma}"
262279
else
263280
ed_unavailableport "${ed_portpma}"
264281
fi
282+
265283
ed_checkingport "${ed_portmh}"
266284
if ed_isthisportfree "${ed_portmh}"; then
267285
ed_availableport "${ed_portmh}"
268286
else
269287
ed_unavailableport "${ed_portmh}"
270288
fi
271-
ed_checkingport "${ed_portrds}"
272-
if ed_isthisportfree "${ed_portrds}"; then
273-
ed_availableport "${ed_portrds}"
274-
else
275-
ed_unavailableport "${ed_portrds}"
276-
fi
277289
}
278290

279291
############################################################ CLI FUNCTIONS
@@ -334,9 +346,9 @@ function ed_info() {
334346

335347
function ed_build() {
336348
echo -e "${blue}Wait... ${reset}${br}"
337-
echo -e "${bgblue}${white} Checking required ports ${reset}"
338-
ed_portscheck
339-
echo -e "${br}${bgblue}${white} Pulling Docker images ${reset}${br}"
349+
#echo -e "${bgblue}${white} Checking required ports ${reset}${br}"
350+
#ed_portscheck
351+
echo -e "${bgblue}${white} Pulling Docker images ${reset}${br}"
340352
#docker-compose -f ./.easydock/docker-compose.yml --env-file=./.env.easydock build --no-cache --pull
341353
docker-compose -f ./.easydock/docker-compose.yml --env-file=./.env.easydock build --pull
342354
sleep 1s
@@ -372,8 +384,8 @@ function ed_remove() {
372384

373385
function ed_up() {
374386
echo -e "${blue}Wait...${reset}${br}"
375-
docker-compose -f ./.easydock/docker-compose.yml --env-file=./.env.easydock down
376-
echo -e "${br}${bgblue}${white} Checking required ports ${reset}"
387+
#docker-compose -f ./.easydock/docker-compose.yml --env-file=./.env.easydock down
388+
echo -e "${bgblue}${white} Checking required ports ${reset}${br}"
377389
ed_portscheck
378390
echo -e "${br}${bgblue}${white} Create and start easydock system ${reset}${br}"
379391
docker-compose -f ./.easydock/docker-compose.yml --env-file=./.env.easydock up -d --force-recreate
@@ -580,7 +592,8 @@ function ed_bootstrap() {
580592
ed_logo
581593

582594
ed_portapp=$(grep APP_PORT .env.easydock | cut -d '=' -f2)
583-
ed_portdb=$(grep DB_PORT .env.easydock | cut -d '=' -f2)
595+
ed_portmysql=$(grep MYSQL_PORT .env.easydock | cut -d '=' -f2)
596+
ed_portpgsql=$(grep POSTGRES_PORT .env.easydock | cut -d '=' -f2)
584597
ed_portrds=$(grep REDIS_PORT .env.easydock | cut -d '=' -f2)
585598
ed_portpma=$(grep PMA_PORT .env.easydock | cut -d '=' -f2)
586599
ed_portmh=$(grep MH_PORT .env.easydock | cut -d '=' -f2)

0 commit comments

Comments
 (0)