poad 2.6.1 → 2.7.1
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/global/init.js +1 -1
- package/global/install.js +3 -2
- package/global/start.js +23 -2
- package/package.json +2 -2
package/global/init.js
CHANGED
package/global/install.js
CHANGED
|
@@ -5,7 +5,6 @@ module.exports = async (args) => {
|
|
|
5
5
|
|
|
6
6
|
const docker = new Docker();
|
|
7
7
|
const imageName = 'poadio/engine:' + global.package.engine;
|
|
8
|
-
const platform = 'linux/amd64';
|
|
9
8
|
|
|
10
9
|
// Create a new progress bar
|
|
11
10
|
const progressBar = new cliProgress.SingleBar(
|
|
@@ -15,7 +14,9 @@ module.exports = async (args) => {
|
|
|
15
14
|
|
|
16
15
|
console.log(chalk.bold('\nInstalling poad environment...'));
|
|
17
16
|
|
|
18
|
-
|
|
17
|
+
// Sans plateforme imposée, Docker tire la variante de la machine (amd64 ou
|
|
18
|
+
// arm64) : sur un Mac Apple Silicon, l'engine tourne sans émulation.
|
|
19
|
+
docker.pull(imageName, (err, stream) => {
|
|
19
20
|
if (err) {
|
|
20
21
|
console.error('Error pulling image:', err);
|
|
21
22
|
return;
|
package/global/start.js
CHANGED
|
@@ -18,14 +18,36 @@ module.exports = async (args) => {
|
|
|
18
18
|
if (await isDockerExist(containerName)) {
|
|
19
19
|
return console.log(chalk.bold('Container already started'));
|
|
20
20
|
}
|
|
21
|
+
const image = 'poadio/engine:' + config.engine;
|
|
22
|
+
// L'image de la version du projet n'est pas forcément là (poad install tire
|
|
23
|
+
// celle du CLI, et config.toml peut en demander une autre) : on la tire.
|
|
24
|
+
try {
|
|
25
|
+
await docker.getImage(image).inspect();
|
|
26
|
+
} catch {
|
|
27
|
+
const pulling = ora(`Pulling ${image}`).start();
|
|
28
|
+
try {
|
|
29
|
+
await new Promise((resolve, reject) =>
|
|
30
|
+
docker.pull(image, (err, stream) =>
|
|
31
|
+
err ? reject(err) : docker.modem.followProgress(stream, (e) => (e ? reject(e) : resolve()))
|
|
32
|
+
)
|
|
33
|
+
);
|
|
34
|
+
pulling.succeed(`${image} pulled.`);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
pulling.fail(chalk.redBright(`Cannot pull ${image}: ${err.message}`));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
21
40
|
const progress = ora('Starting container').start();
|
|
22
41
|
docker
|
|
23
42
|
.createContainer({
|
|
24
43
|
name: containerName,
|
|
25
|
-
Image:
|
|
44
|
+
Image: image,
|
|
26
45
|
Tty: false,
|
|
27
46
|
Env: [
|
|
28
47
|
'OMNEEDIA_GATEWAY_URL=http://localhost:' + config.web.port,
|
|
48
|
+
// Projet local : le service auth accepte les redirections vers
|
|
49
|
+
// http://localhost:* (désactivé par défaut, hors du CLI)
|
|
50
|
+
'OMNEEDIA_AUTH_ALLOW_LOCALHOST_REDIRECTS=true',
|
|
29
51
|
'DATA_VOLUME_MOUNTPOINT=/data',
|
|
30
52
|
'POSTGRES_PASSWORD=postgres',
|
|
31
53
|
'ADMIN_API_KEY=' + config.auth.admin,
|
|
@@ -52,7 +74,6 @@ module.exports = async (args) => {
|
|
|
52
74
|
Binds: [path.dirname(root) + '/data:/data'],
|
|
53
75
|
AutoRemove: true,
|
|
54
76
|
},
|
|
55
|
-
Platform: 'linux/amd64',
|
|
56
77
|
})
|
|
57
78
|
.then((container) => {
|
|
58
79
|
return container.start();
|