Skip to content

Commit 7ff22ec

Browse files
authored
Merge pull request #9 from joglomedia/linux
v1.1.0
2 parents 5ee4cf9 + f27c453 commit 7ff22ec

File tree

11 files changed

+162
-81
lines changed

11 files changed

+162
-81
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.env
2+
composer.lock
3+
vendor
4+
src/docker-compose.yml~
5+
src/Dockerfile~

README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
![EasyDock for Linux](ed_275px.png)
44

5-
A fork of EasyDock to work in Linux. Dockerize your PHP apps ;)
5+
A fork of EasyDock for Linux. Docker LEMP stack easy integration.
66

7-
Docker LEMP easy integration
7+
Dockerize your PHP apps ;)
88

99
![GitHub stars](https://img.shields.io/github/stars/joglomedia/easydock-linux?style=social)
1010
![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/joglomedia/easydock-linux?label=version)
@@ -19,14 +19,13 @@ Easydock comes with:
1919
- Redis
2020
- ~~phpmyadmin~~ Adminer (Lightweight MySQL admin)
2121
- MailHog
22-
- ~~node.js~~
23-
- ~~npm~~
22+
- Node.js, NPM & Yarn
2423
- Git
2524
- Composer
2625

2726
## Requirements
2827

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

3130
## Installation
3231

@@ -49,7 +48,7 @@ easydock init && easydock import
4948
easydock build
5049
```
5150

52-
- Config your app DB connection (default)
51+
### Config your app DB connection (default)
5352

5453
```bash
5554
user: root
@@ -58,58 +57,59 @@ db: dockerdb
5857
host: mysql ( or redis for Redis )
5958
```
6059

61-
- Config your app SMTP conn (default - no user or pass are required)
60+
### Config your app SMTP conn (default - no user or pass are required)
6261

6362
```bash
6463
host: mailhog
6564
port: 1025
6665
```
6766

68-
- Nginx config will expose your project `/public` folder
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.
6969

70-
- To start your Docker istance:
70+
### To start your Docker istance
7171

7272
```bash
7373
easydock up
7474
```
7575

76-
- To stop your Docker istance:
76+
### To stop your Docker istance
7777

7878
```bash
7979
easydock stop
8080
```
8181

82-
- To restart your Docker istance:
82+
### To restart your Docker istance
8383

8484
```bash
8585
easydock restart
8686
```
8787

88-
- To stop and delete your Docker istance:
88+
### To stop and delete your Docker istance
8989

9090
```bash
9191
easydock down
9292
```
9393

94-
- To "SSH" into your Docker istance:
94+
### To "SSH" into your Docker istance
9595

9696
```bash
9797
easydock shell
9898
```
9999

100-
- You can get application info using:
100+
### You can get application info using
101101

102102
```bash
103103
easydock info
104104
```
105105

106-
- You can reset your Docker istance running:
106+
### You can reset your Docker istance running
107107

108108
```bash
109109
easydock reset
110110
```
111111

112-
- Everytime you change PHP version into `.env.easydock` file you have to run:
112+
### Everytime you change PHP version into `.env.easydock` file you have to run
113113

114114
```bash
115115
easydock reset && easydock build

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "joglomedia/easydock-linux",
33
"type": "project",
4-
"description": "A fork of EasyDock to work in Linux. Docker LEMP easy integration.",
4+
"description": "A fork of EasyDock for Linux. Docker LEMP stack easy integration.",
55
"keywords": ["docker", "container", "lemp", "lnmp", "nginx", "php", "ubuntu", "debian"],
66
"license": "MIT",
77
"authors": [

config/.env.easydock

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ APP_WORKER=1
2020
APP_PORT=8008
2121

2222
# PHP VERSION
23-
PHP_VERSION=8.0
24-
25-
# Nodejs Version
26-
NODE_VERSION=12.18.4
23+
PHP_VERSION=7.4
2724

2825
# MYSQL DB NAME
2926
DB_NAME=easydockdb

config/nginx/01-upstream.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
upstream php-fpm {
2+
server webapp:9000;
3+
#server unix:/var/run/php-fpm.sock;
4+
}

config/nginx/app.conf

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
server {
22
listen 80;
3+
listen [::]:80;
34

4-
server_name localhost;
5+
server_name localhost localhost.localhost;
56

6-
index index.html index.php;
7-
8-
error_log /var/log/nginx/error.log;
97
access_log /var/log/nginx/access.log;
8+
error_log /var/log/nginx/error.log;
109

1110
root /var/www/public;
12-
13-
client_max_body_size 256m;
11+
index index.html index.php;
12+
13+
client_max_body_size 20M;
14+
client_body_buffer_size 128k;
15+
server_tokens off;
1416

1517
location ~ \.php$ {
1618
try_files $uri =404;
1719
fastcgi_split_path_info ^(.+\.php)(/.+)$;
18-
fastcgi_pass app:9000;
20+
fastcgi_pass php-fpm; # passed to upstream server from 01-upstream.conf
1921
fastcgi_index index.php;
2022
include fastcgi_params;
2123
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

config/php/php.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ display_errors = On
22
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
33
date.timezone = UTC
44
max_execution_time = 360
5-
memory_limit = 512M
6-
post_max_size = 256M
7-
upload_max_filesize = 256M
5+
memory_limit = 256M
6+
post_max_size = 32M
7+
upload_max_filesize = 32M

config/php/zz-docker.conf

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[global]
2+
daemonize = no
3+
4+
; Redirect log to file.
5+
;error_log = /var/log/php/php-fpm.log
6+
7+
[www]
8+
;user = www-data
9+
;group = www-data
10+
11+
; Listen via socket instead tcp port.
12+
listen = 9000
13+
;listen = /var/run/php-fpm.sock
14+
;listen.owner = www
15+
;listen.group = www
16+
;listen.mode = 0666
17+
18+
; Custom PHP-FPM optimization here
19+
; adjust to meet your needs.
20+
pm = dynamic
21+
pm.max_children = 5
22+
pm.start_servers = 2
23+
pm.min_spare_servers = 1
24+
pm.max_spare_servers = 3
25+
pm.process_idle_timeout = 30s
26+
pm.max_requests = 500
27+
28+
; Redirect log to file.
29+
;access.log = /var/log/php/php-fpm_access.log
30+
;slowlog = /var/log/php/php-fpm_slow.log
31+
;request_slowlog_timeout = 5s
32+
33+
; Default Value: nothing is defined by default except the values in php.ini and
34+
; specified at startup with the -d argument
35+
php_admin_flag[log_errors] = On
36+
php_admin_value[error_log] = /var/log/php/php-fpm.log

src/Dockerfile

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Dockerfile Args
22
ARG PHP_VERSION
3-
ARG NODE_VERSION
43

54
# Use PHP image
65
FROM php:${PHP_VERSION}-fpm-alpine
@@ -12,7 +11,8 @@ LABEL maintainer Edi Septriyanto <me@masedi.net> architecture="amd64/x86_64"
1211
WORKDIR /var/www
1312

1413
# Add PHP extension installer
15-
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
14+
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions \
15+
/usr/local/bin/
1616

1717
# Install dependencies
1818
RUN apk update && apk upgrade \
@@ -66,17 +66,21 @@ RUN apk update && apk upgrade \
6666
# Install composer
6767
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
6868
# Install node & npm (not yet required for php application)
69-
&& apk add --update nodejs=${NODE_VERSION} npm yarn \
69+
&& apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/main/ nodejs npm \
70+
&& apk add --no-cache --repository https://dl-cdn.alpinelinux.org/alpine/edge/community/ yarn \
71+
# Clean up install.
72+
&& rm -rf /var/cache/apk/* \
7073
# Add user
71-
&& set -eux; \
72-
addgroup -g 1000 -S www; \
73-
adduser -u 1000 -h /var/www -s /bin/bash -D -S -G www www \
74+
&& set -eux \
75+
&& addgroup -g 1000 -S www \
76+
&& adduser -u 1000 -h /var/www -s /bin/bash -D -S -G www www \
7477
# User permissions
75-
&& chown -R www:www /var/www
78+
&& chown -R www:www /var/www
7679

7780
# Change current user to www
7881
USER www
7982

8083
# Expose port 9000
8184
EXPOSE 9000
85+
8286
CMD ["php-fpm"]

0 commit comments

Comments
 (0)