create-directus-docker 1.7.2 → 1.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/templates/default/docker-compose-nginx.yml +17 -7
- package/templates/default/docker-compose.yml +13 -4
- package/templates/default/lib/index.js +13 -5
- package/templates/default/package.json +1 -1
- package/templates/default/redis/Dockerfile +5 -0
- package/templates/default/redis/init.sh +30 -0
- package/templates/default/redis/redis.conf +2326 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-directus-docker",
|
|
3
3
|
"description": "An installer for Dockerized Directus + MySQL + Adminer + GraphQL Sandbox with a helper Node app",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Dave Kobrenski",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"copy:compose-nginx": "copy-file ../directus-mysql-template/docker-compose-nginx.yml ./templates/default/docker-compose-nginx.yml",
|
|
31
31
|
"copy:readme": "copy-file ../directus-mysql-template/README.md ./templates/default/README.md",
|
|
32
32
|
"copy:lib": "copyfiles --flat ../directus-mysql-template/lib/*.js ./templates/default/lib",
|
|
33
|
+
"copy:redis": "copyfiles --flat ../directus-mysql-template/redis/* ./templates/default/redis",
|
|
33
34
|
"copy:conf": "copy-file ../directus-mysql-template/custom_proxy_settings.conf ./templates/default/custom_proxy_settings.conf"
|
|
34
35
|
},
|
|
35
36
|
"files": [
|
|
@@ -52,9 +52,8 @@ services:
|
|
|
52
52
|
ports:
|
|
53
53
|
- 3306:3306
|
|
54
54
|
volumes:
|
|
55
|
-
-
|
|
55
|
+
- mysql-data:/var/lib/mysql
|
|
56
56
|
- ./init:/docker-entrypoint-initdb.d
|
|
57
|
-
# command: --mysql-native-password=ON
|
|
58
57
|
environment:
|
|
59
58
|
MYSQL_USER: ${MYSQL_USER}
|
|
60
59
|
MYSQL_PASSWORD: ${MYSQL_PASS}
|
|
@@ -79,20 +78,28 @@ services:
|
|
|
79
78
|
|
|
80
79
|
cache:
|
|
81
80
|
container_name: cache
|
|
82
|
-
|
|
81
|
+
build:
|
|
82
|
+
context: ./redis
|
|
83
|
+
restart: always
|
|
84
|
+
privileged: true
|
|
85
|
+
environment:
|
|
86
|
+
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
87
|
+
command: ["sh", "-c", "./init.sh"]
|
|
83
88
|
healthcheck:
|
|
84
|
-
test: ["CMD
|
|
89
|
+
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
|
85
90
|
interval: 10s
|
|
86
91
|
timeout: 5s
|
|
87
92
|
retries: 5
|
|
88
93
|
start_interval: 5s
|
|
89
94
|
start_period: 30s
|
|
95
|
+
volumes:
|
|
96
|
+
- redis_data:/data:rw
|
|
90
97
|
networks:
|
|
91
98
|
- directus
|
|
92
99
|
|
|
93
100
|
directus:
|
|
94
101
|
container_name: directus
|
|
95
|
-
image: directus/directus:11.
|
|
102
|
+
image: directus/directus:11.12.0
|
|
96
103
|
restart: always
|
|
97
104
|
ports:
|
|
98
105
|
- ${DIRECTUS_PORT}:8055
|
|
@@ -117,6 +124,7 @@ services:
|
|
|
117
124
|
DB_PASSWORD: ${MYSQL_PASS}
|
|
118
125
|
DB_DATABASE: ${MYSQL_DB}
|
|
119
126
|
DB_PORT: '3306'
|
|
127
|
+
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
120
128
|
|
|
121
129
|
VIRTUAL_HOST: ${VIRTUAL_HOST}
|
|
122
130
|
VIRTUAL_PORT: ${DIRECTUS_PORT}
|
|
@@ -125,7 +133,7 @@ services:
|
|
|
125
133
|
|
|
126
134
|
CACHE_ENABLED: 'true'
|
|
127
135
|
CACHE_STORE: 'redis'
|
|
128
|
-
REDIS: 'redis://cache:6379'
|
|
136
|
+
REDIS: 'redis://default:${REDIS_PASSWORD}@cache:6379'
|
|
129
137
|
CACHE_AUTO_PURGE: 'true'
|
|
130
138
|
CACHE_SYSTEM_TTL: '2m'
|
|
131
139
|
CACHE_SCHEMA: 'false'
|
|
@@ -152,4 +160,6 @@ volumes:
|
|
|
152
160
|
vhost:
|
|
153
161
|
html:
|
|
154
162
|
certs:
|
|
155
|
-
acme:
|
|
163
|
+
acme:
|
|
164
|
+
redis_data:
|
|
165
|
+
mysql-data:
|
|
@@ -17,7 +17,6 @@ services:
|
|
|
17
17
|
volumes:
|
|
18
18
|
- mysql-data:/var/lib/mysql
|
|
19
19
|
- ./init:/docker-entrypoint-initdb.d
|
|
20
|
-
# command: --mysql-native-password=ON
|
|
21
20
|
environment:
|
|
22
21
|
MYSQL_USER: ${MYSQL_USER}
|
|
23
22
|
MYSQL_PASSWORD: ${MYSQL_PASS}
|
|
@@ -42,14 +41,22 @@ services:
|
|
|
42
41
|
|
|
43
42
|
cache:
|
|
44
43
|
container_name: cache
|
|
45
|
-
|
|
44
|
+
build:
|
|
45
|
+
context: ./redis
|
|
46
|
+
restart: always
|
|
47
|
+
privileged: true
|
|
48
|
+
environment:
|
|
49
|
+
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
50
|
+
command: ["sh", "-c", "REDIS_PASSWORD=${REDIS_PASSWORD} ./init.sh"]
|
|
46
51
|
healthcheck:
|
|
47
|
-
test: ["CMD
|
|
52
|
+
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
|
|
48
53
|
interval: 10s
|
|
49
54
|
timeout: 5s
|
|
50
55
|
retries: 5
|
|
51
56
|
start_interval: 5s
|
|
52
57
|
start_period: 30s
|
|
58
|
+
volumes:
|
|
59
|
+
- redis_data:/data:rw
|
|
53
60
|
networks:
|
|
54
61
|
- directus
|
|
55
62
|
|
|
@@ -78,10 +85,11 @@ services:
|
|
|
78
85
|
DB_PASSWORD: ${MYSQL_PASS}
|
|
79
86
|
DB_DATABASE: ${MYSQL_DB}
|
|
80
87
|
DB_PORT: '3306'
|
|
88
|
+
REDIS_PASSWORD: ${REDIS_PASSWORD}
|
|
81
89
|
|
|
82
90
|
CACHE_ENABLED: 'true'
|
|
83
91
|
CACHE_STORE: 'redis'
|
|
84
|
-
REDIS: 'redis://cache:6379'
|
|
92
|
+
REDIS: 'redis://default:${REDIS_PASSWORD}@cache:6379'
|
|
85
93
|
CACHE_AUTO_PURGE: 'true'
|
|
86
94
|
CACHE_SYSTEM_TTL: '2m'
|
|
87
95
|
CACHE_SCHEMA: 'false'
|
|
@@ -102,6 +110,7 @@ services:
|
|
|
102
110
|
|
|
103
111
|
volumes:
|
|
104
112
|
mysql-data:
|
|
113
|
+
redis_data:
|
|
105
114
|
networks:
|
|
106
115
|
directus:
|
|
107
116
|
driver: bridge
|
|
@@ -43,11 +43,11 @@ try {
|
|
|
43
43
|
let git = await gitData();
|
|
44
44
|
let mode = 0o777;
|
|
45
45
|
|
|
46
|
-
if (fs.existsSync(path.join(rootPath, 'mysql')) === false) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
46
|
+
// if (fs.existsSync(path.join(rootPath, 'mysql')) === false) {
|
|
47
|
+
// fs.mkdir(path.join(rootPath, 'mysql'), () => {
|
|
48
|
+
// //console.log(`'mysql' directory created.`);
|
|
49
|
+
// });
|
|
50
|
+
// }
|
|
51
51
|
|
|
52
52
|
if (fs.existsSync(path.join(rootPath, 'directus')) === false) {
|
|
53
53
|
fs.mkdir(path.join(rootPath, 'directus'), { mode }, () => {
|
|
@@ -117,6 +117,11 @@ try {
|
|
|
117
117
|
message: "Root password:",
|
|
118
118
|
default: generator.generate({ length: 14, numbers: true, symbols: false })
|
|
119
119
|
},
|
|
120
|
+
{
|
|
121
|
+
name: 'REDIS_PASSWORD',
|
|
122
|
+
message: "Redis cache password:",
|
|
123
|
+
default: generator.generate({ length: 14, numbers: true, symbols: false })
|
|
124
|
+
},
|
|
120
125
|
{
|
|
121
126
|
name: 'DIRECTUS_DOMAIN',
|
|
122
127
|
message: "Web address to run on. For example, 'https://mydomain.com' Leave as localhost if running in dev environment.",
|
|
@@ -156,6 +161,9 @@ try {
|
|
|
156
161
|
writeStream.write(`MYSQL_ROOT_PASS="${answers.MYSQL_ROOT_PASS}"`);
|
|
157
162
|
writeStream.write("\n\n");
|
|
158
163
|
|
|
164
|
+
writeStream.write("# Set a password for redis. Make sure this matches the password in the redis/init.sh file\n");
|
|
165
|
+
writeStream.write(`REDIS_PASSWORD="${answers.REDIS_PASSWORD}"\n\n`);
|
|
166
|
+
|
|
159
167
|
writeStream.write("# Set the domain for directus to use:\n");
|
|
160
168
|
writeStream.write("# eg, https://mydomain.com\n");
|
|
161
169
|
writeStream.write("# in local dev environments, just leave it set to localhost:port\n");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# WARNING you have Transparent Huge Pages (THP) support enabled in your kernel.
|
|
2
|
+
# This will create latency and memory usage issues with Redis.
|
|
3
|
+
# To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root,
|
|
4
|
+
# and add it to your /etc/rc.local in order to retain the setting after a reboot.
|
|
5
|
+
# Redis must be restarted after THP is disabled.
|
|
6
|
+
|
|
7
|
+
echo never > /sys/kernel/mm/transparent_hugepage/enabled
|
|
8
|
+
echo never > /sys/kernel/mm/transparent_hugepage/defrag
|
|
9
|
+
|
|
10
|
+
# WARNING: The TCP backlog setting of 511 cannot be enforced
|
|
11
|
+
# because /proc/sys/net/core/somaxconn is set to the lower value of 128.
|
|
12
|
+
|
|
13
|
+
sysctl -w net.core.somaxconn=512
|
|
14
|
+
|
|
15
|
+
# WARNING overcommit_memory is set to 0! Background save may fail under low memory condition.
|
|
16
|
+
# To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot
|
|
17
|
+
# or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
|
|
18
|
+
# The overcommit_memory has 3 options.
|
|
19
|
+
# 0, the system kernel check if there is enough memory to be allocated to the process or not,
|
|
20
|
+
# if not enough, it will return errors to the process.
|
|
21
|
+
# 1, the system kernel is allowed to allocate the whole memory to the process
|
|
22
|
+
# no matter what the status of memory is.
|
|
23
|
+
# 2, the system kernel is allowed to allocate a memory whose size could be bigger than
|
|
24
|
+
# the sum of the size of physical memory and the size of exchange workspace to the process.
|
|
25
|
+
|
|
26
|
+
sysctl vm.overcommit_memory=1
|
|
27
|
+
|
|
28
|
+
# start redis server
|
|
29
|
+
|
|
30
|
+
redis-server /usr/local/etc/redis/redis.conf --loglevel warning --bind 0.0.0.0 --requirepass $REDIS_PASSWORD
|