create-directus-docker 1.3.4 → 1.3.5
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
CHANGED
|
@@ -7,7 +7,7 @@ services:
|
|
|
7
7
|
image: mysql:8
|
|
8
8
|
restart: always
|
|
9
9
|
healthcheck:
|
|
10
|
-
test: ['mysqladmin', 'ping', '--silent']
|
|
10
|
+
test: ['CMD', 'mysqladmin', 'ping', '--silent']
|
|
11
11
|
interval: 5s
|
|
12
12
|
timeout: 20s
|
|
13
13
|
retries: 3
|
|
@@ -47,8 +47,9 @@ services:
|
|
|
47
47
|
directus:
|
|
48
48
|
container_name: directus
|
|
49
49
|
image: directus/directus:latest
|
|
50
|
+
restart: always
|
|
50
51
|
ports:
|
|
51
|
-
-
|
|
52
|
+
- ${DIRECTUS_PORT}:8055
|
|
52
53
|
volumes:
|
|
53
54
|
- ./directus/uploads:/directus/uploads
|
|
54
55
|
networks:
|
|
@@ -72,7 +73,7 @@ services:
|
|
|
72
73
|
ADMIN_EMAIL: ${ADMIN_EMAIL}
|
|
73
74
|
ADMIN_PASSWORD: ${ADMIN_PASSWORD}
|
|
74
75
|
CORS_ENABLED: 'true'
|
|
75
|
-
CORS_ORIGIN: '
|
|
76
|
+
CORS_ORIGIN: 'true'
|
|
76
77
|
|
|
77
78
|
PUBLIC_URL: ${PUBLIC_URL}
|
|
78
79
|
|
|
@@ -103,6 +103,16 @@ try {
|
|
|
103
103
|
name: 'MYSQL_ROOT_PASS',
|
|
104
104
|
message: "Root password:",
|
|
105
105
|
default: generator.generate({ length: 14, numbers: true, symbols: false })
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: 'DIRECTUS_DOMAIN',
|
|
109
|
+
message: "Web address to run on. For example, 'https://mydomain.com' Leave as localhost if running in dev environment.",
|
|
110
|
+
default: 'localhost'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'DIRECTUS_PORT',
|
|
114
|
+
message: "Port to access Directus on:",
|
|
115
|
+
default: '8055'
|
|
106
116
|
}
|
|
107
117
|
]).then(answers => {
|
|
108
118
|
console.log(chalk.magentaBright("\nWriting to environment file. Be sure to take note of your credentials below, you'll need them shortly!\n"));
|
|
@@ -136,12 +146,29 @@ try {
|
|
|
136
146
|
writeStream.write("# Set the domain for directus to use:\n");
|
|
137
147
|
writeStream.write("# eg, https://mydomain.com\n");
|
|
138
148
|
writeStream.write("# in local dev environments, just leave it set to localhost:port\n");
|
|
139
|
-
writeStream.write("
|
|
140
|
-
writeStream.write("
|
|
149
|
+
writeStream.write(`DIRECTUS_DOMAIN="${answers.DIRECTUS_DOMAIN}"\n`);
|
|
150
|
+
writeStream.write(`DIRECTUS_PORT="${answers.DIRECTUS_PORT}"\n`);
|
|
151
|
+
|
|
152
|
+
if(answers.DIRECTUS_DOMAIN === "localhost") {
|
|
153
|
+
if(answers.DIRECTUS_PORT === 80) {
|
|
154
|
+
writeStream.write(`PUBLIC_URL="http://localhost"\n`);
|
|
155
|
+
writeStream.write(`API_ENDPOINT="http://localhost/graphql"`);
|
|
156
|
+
} else {
|
|
157
|
+
writeStream.write(`PUBLIC_URL="http://localhost:${answers.DIRECTUS_PORT}"\n`);
|
|
158
|
+
writeStream.write(`API_ENDPOINT="http://localhost:${answers.DIRECTUS_PORT}/graphql"`);
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
if(answers.DIRECTUS_PORT === 80) {
|
|
162
|
+
writeStream.write(`PUBLIC_URL="${answers.DIRECTUS_DOMAIN}"\n`);
|
|
163
|
+
writeStream.write(`API_ENDPOINT="${answers.DIRECTUS_DOMAIN}/graphql"`);
|
|
164
|
+
} else {
|
|
165
|
+
writeStream.write(`PUBLIC_URL="${answers.DIRECTUS_DOMAIN}:${answers.DIRECTUS_PORT}"\n`);
|
|
166
|
+
writeStream.write(`API_ENDPOINT="${answers.DIRECTUS_DOMAIN}:${answers.DIRECTUS_PORT}/graphql"`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
141
169
|
|
|
142
170
|
writeStream.end();
|
|
143
171
|
|
|
144
|
-
//console.log(chalk.greenBright("\nAll set!"));
|
|
145
172
|
console.log("\nYou can always edit the variables that we've just set in the .env file manually.\n");
|
|
146
173
|
|
|
147
174
|
inquirer.prompt([
|
|
@@ -5,9 +5,11 @@ import { spawn } from 'node:child_process';
|
|
|
5
5
|
import logUpdate from 'log-update';
|
|
6
6
|
import open from 'open';
|
|
7
7
|
import inquirer from 'inquirer';
|
|
8
|
+
import * as dotenv from 'dotenv';
|
|
9
|
+
dotenv.config();
|
|
8
10
|
|
|
9
11
|
export default function launchServices() {
|
|
10
|
-
const launch = spawn('docker', ['
|
|
12
|
+
const launch = spawn('docker-compose', ['up', '-d', 'mysql']);
|
|
11
13
|
|
|
12
14
|
const opts = {
|
|
13
15
|
resources: [
|
|
@@ -42,7 +44,7 @@ export default function launchServices() {
|
|
|
42
44
|
logUpdate("Building and launching containers:\n");
|
|
43
45
|
logUpdate.done();
|
|
44
46
|
|
|
45
|
-
const launch2 = spawn('docker', ['
|
|
47
|
+
const launch2 = spawn('docker-compose', ['up', '-d']);
|
|
46
48
|
|
|
47
49
|
launch2.stderr.on('data', (data) => {
|
|
48
50
|
logUpdate(`${data}`);
|
|
@@ -52,9 +54,15 @@ export default function launchServices() {
|
|
|
52
54
|
logUpdate('Done.');
|
|
53
55
|
logUpdate.done();
|
|
54
56
|
|
|
57
|
+
if(process.env.DIRECTUS_DOMAIN === 'localhost') {
|
|
58
|
+
var appURL = 'http://localhost';
|
|
59
|
+
} else {
|
|
60
|
+
var appURL = process.env.DIRECTUS_DOMAIN;
|
|
61
|
+
}
|
|
62
|
+
|
|
55
63
|
const pingOpts = {
|
|
56
64
|
resources: [
|
|
57
|
-
|
|
65
|
+
`${process.env.PUBLIC_URL}`
|
|
58
66
|
],
|
|
59
67
|
delay: 1000,
|
|
60
68
|
interval: 300,
|
|
@@ -70,10 +78,9 @@ export default function launchServices() {
|
|
|
70
78
|
logUpdate.done();
|
|
71
79
|
|
|
72
80
|
console.log(chalk.green("\nAll services should be ready. You can access them at the following URLs:\n"));
|
|
73
|
-
|
|
74
|
-
console.log(`
|
|
75
|
-
console.log(`
|
|
76
|
-
console.log(`GraphiQL Playground: ${chalk.cyan("http://localhost:4000/graphql")}`);
|
|
81
|
+
console.log(`Directus CMS: ${chalk.cyan(process.env.PUBLIC_URL)}`);
|
|
82
|
+
console.log(`Adminer: ${chalk.cyan(appURL + ":8080")}`);
|
|
83
|
+
console.log(`GraphiQL Playground: ${chalk.cyan(appURL + ":4000/graphql")}`);
|
|
77
84
|
|
|
78
85
|
console.log(`\n${chalk.redBright("Note: learn how to avoid CORS errors in the GraphiQL Playground when running on localhost:")}`);
|
|
79
86
|
console.log(`https://github.com/rollmug/directus-mysql-template#cors-problems-on-localhost`)
|
|
@@ -91,9 +98,9 @@ export default function launchServices() {
|
|
|
91
98
|
}
|
|
92
99
|
]).then(answers => {
|
|
93
100
|
if(answers.open_now === true) {
|
|
94
|
-
open(
|
|
95
|
-
open(
|
|
96
|
-
open(
|
|
101
|
+
open(process.env.PUBLIC_URL);
|
|
102
|
+
open(`${appURL}:8080`);
|
|
103
|
+
open(`${appURL}:4000/graphql`);
|
|
97
104
|
} else {
|
|
98
105
|
process.exit(1);
|
|
99
106
|
}
|