@ossy/deployment-tools 0.0.17 → 0.0.19
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/dist/index.js +3 -134
- package/package.json +1 -1
- package/src/caddy-client.js +2 -1
- package/src/index.js +1 -20
- package/src/caddy.service.js +0 -68
- package/src/deployment-tools.service.js +0 -41
package/dist/index.js
CHANGED
|
@@ -28471,7 +28471,8 @@ class CaddyClient {
|
|
|
28471
28471
|
dns:{
|
|
28472
28472
|
provider:{
|
|
28473
28473
|
'max_retries': 10,
|
|
28474
|
-
name: 'route53'
|
|
28474
|
+
name: 'route53',
|
|
28475
|
+
'aws_profile': 'ci-client'
|
|
28475
28476
|
}
|
|
28476
28477
|
}
|
|
28477
28478
|
},
|
|
@@ -28836,119 +28837,6 @@ class ContainerManagerCommands {
|
|
|
28836
28837
|
|
|
28837
28838
|
}
|
|
28838
28839
|
|
|
28839
|
-
;// CONCATENATED MODULE: ./src/deployment-tools.service.js
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
const systemdServiceFile = `
|
|
28846
|
-
[Unit]
|
|
28847
|
-
Description=D
|
|
28848
|
-
After=network.target caddy-route53.service
|
|
28849
|
-
|
|
28850
|
-
[Service]
|
|
28851
|
-
Environment=DEPLOYMENT_TOOLS_DOMAIN=${domain}
|
|
28852
|
-
Environment=DEPLOYMENT_TOOLS_ENVIRONMENT_NAME=${environmentName}
|
|
28853
|
-
Environment=DEPLOYMENT_TOOLS_CI_SUB_DOMAIN=${ciSubDomain}
|
|
28854
|
-
Environment=DEPLOYMENT_TOOLS_PORT=${port}
|
|
28855
|
-
User=caddy
|
|
28856
|
-
Group=caddy
|
|
28857
|
-
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
28858
|
-
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
28859
|
-
ExecStart=/usr/bin/npx @ossy/deployment-tools start-container-manager
|
|
28860
|
-
Restart=on-failure
|
|
28861
|
-
|
|
28862
|
-
[Install]
|
|
28863
|
-
WantedBy=multi-user.target
|
|
28864
|
-
`
|
|
28865
|
-
|
|
28866
|
-
class DeploymentToolsService {
|
|
28867
|
-
|
|
28868
|
-
static install() {
|
|
28869
|
-
;(0,external_fs_.writeFileSync)('/etc/systemd/system/deployment-tools.service', systemdServiceFile)
|
|
28870
|
-
}
|
|
28871
|
-
|
|
28872
|
-
static enable() {
|
|
28873
|
-
(0,external_child_process_namespaceObject.exec)('systemctl enable deployment-tools.service')
|
|
28874
|
-
}
|
|
28875
|
-
|
|
28876
|
-
static start() {
|
|
28877
|
-
(0,external_child_process_namespaceObject.exec)('systemctl start deployment-tools.service')
|
|
28878
|
-
}
|
|
28879
|
-
|
|
28880
|
-
}
|
|
28881
|
-
|
|
28882
|
-
;// CONCATENATED MODULE: ./src/caddy.service.js
|
|
28883
|
-
|
|
28884
|
-
|
|
28885
|
-
|
|
28886
|
-
const caddy_service_systemdServiceFile = `
|
|
28887
|
-
# caddy-api.service
|
|
28888
|
-
#
|
|
28889
|
-
# For using Caddy with its API.
|
|
28890
|
-
#
|
|
28891
|
-
# This unit is "durable" in that it will automatically resume
|
|
28892
|
-
# the last active configuration if the service is restarted.
|
|
28893
|
-
#
|
|
28894
|
-
# See https://caddyserver.com/docs/install for instructions.
|
|
28895
|
-
|
|
28896
|
-
[Unit]
|
|
28897
|
-
Description=Caddy
|
|
28898
|
-
Documentation=https://caddyserver.com/docs/
|
|
28899
|
-
After=network.target network-online.target
|
|
28900
|
-
Requires=network-online.target
|
|
28901
|
-
|
|
28902
|
-
[Service]
|
|
28903
|
-
Type=notify
|
|
28904
|
-
User=caddy
|
|
28905
|
-
Group=caddy
|
|
28906
|
-
ExecStart=/usr/bin/caddy.route53 run --environ --resume
|
|
28907
|
-
TimeoutStopSec=5s
|
|
28908
|
-
LimitNOFILE=1048576
|
|
28909
|
-
LimitNPROC=512
|
|
28910
|
-
PrivateTmp=true
|
|
28911
|
-
ProtectSystem=full
|
|
28912
|
-
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
28913
|
-
|
|
28914
|
-
[Install]
|
|
28915
|
-
WantedBy=multi-user.target
|
|
28916
|
-
`
|
|
28917
|
-
|
|
28918
|
-
class CaddyService {
|
|
28919
|
-
|
|
28920
|
-
static install() {
|
|
28921
|
-
;(0,external_fs_.writeFileSync)('/etc/systemd/system/caddy-route53.service', caddy_service_systemdServiceFile)
|
|
28922
|
-
|
|
28923
|
-
[
|
|
28924
|
-
'apt install -y debian-keyring debian-archive-keyring apt-transport-https',
|
|
28925
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg',
|
|
28926
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-stable.list',
|
|
28927
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg',
|
|
28928
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list',
|
|
28929
|
-
'add-apt-repository ppa:longsleep/golang-backports -y',
|
|
28930
|
-
'apt update',
|
|
28931
|
-
'apt install caddy xcaddy golang-go -y',
|
|
28932
|
-
|
|
28933
|
-
// xcaddy custom build with route53 integration
|
|
28934
|
-
'xcaddy build --with github.com/caddy-dns/route53',
|
|
28935
|
-
// 'sudo dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy',
|
|
28936
|
-
'mv ./caddy /usr/bin/caddy.route53'
|
|
28937
|
-
// 'update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10',
|
|
28938
|
-
// 'update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50',
|
|
28939
|
-
].forEach(command => (0,external_child_process_namespaceObject.exec)(command))
|
|
28940
|
-
}
|
|
28941
|
-
|
|
28942
|
-
static enable() {
|
|
28943
|
-
(0,external_child_process_namespaceObject.exec)('systemctl enable caddy-route53.service')
|
|
28944
|
-
}
|
|
28945
|
-
|
|
28946
|
-
static start() {
|
|
28947
|
-
(0,external_child_process_namespaceObject.exec)('systemctl start caddy-route53.service')
|
|
28948
|
-
}
|
|
28949
|
-
|
|
28950
|
-
}
|
|
28951
|
-
|
|
28952
28840
|
;// CONCATENATED MODULE: ./src/index.js
|
|
28953
28841
|
|
|
28954
28842
|
|
|
@@ -28956,8 +28844,6 @@ class CaddyService {
|
|
|
28956
28844
|
|
|
28957
28845
|
|
|
28958
28846
|
|
|
28959
|
-
|
|
28960
|
-
|
|
28961
28847
|
const [_, __, command, ...restArgs] = process.argv
|
|
28962
28848
|
|
|
28963
28849
|
const startHandler = () => {
|
|
@@ -28972,21 +28858,6 @@ const startHandler = () => {
|
|
|
28972
28858
|
return console.error('Deployment tools do not support this os')
|
|
28973
28859
|
}
|
|
28974
28860
|
|
|
28975
|
-
CaddyService.install()
|
|
28976
|
-
DeploymentToolsService.install()
|
|
28977
|
-
|
|
28978
|
-
;(0,external_child_process_namespaceObject.exec)('systemctl daemon-reload')
|
|
28979
|
-
|
|
28980
|
-
CaddyService.enable()
|
|
28981
|
-
DeploymentToolsService.enable()
|
|
28982
|
-
|
|
28983
|
-
CaddyService.start()
|
|
28984
|
-
DeploymentToolsService.start()
|
|
28985
|
-
|
|
28986
|
-
}
|
|
28987
|
-
|
|
28988
|
-
const startContainerManagerHandler = () => {
|
|
28989
|
-
console.log('Running start-container-manager command')
|
|
28990
28861
|
ContainerManagerServer.start()
|
|
28991
28862
|
}
|
|
28992
28863
|
|
|
@@ -29035,9 +28906,7 @@ const Commands = {
|
|
|
29035
28906
|
start: startHandler,
|
|
29036
28907
|
stop: stopHandler,
|
|
29037
28908
|
status: statusHandler,
|
|
29038
|
-
deploy: deployHandler
|
|
29039
|
-
// internal commands
|
|
29040
|
-
'start-container-manager': startContainerManagerHandler
|
|
28909
|
+
deploy: deployHandler
|
|
29041
28910
|
}
|
|
29042
28911
|
|
|
29043
28912
|
const commandHandler = Commands[command]
|
package/package.json
CHANGED
package/src/caddy-client.js
CHANGED
package/src/index.js
CHANGED
|
@@ -4,8 +4,6 @@ import { exec } from 'child_process'
|
|
|
4
4
|
import arg from 'arg'
|
|
5
5
|
import { ContainerManagerServer } from './container-manager-server.js'
|
|
6
6
|
import { ContainerManagerCommands } from './container-manager-commands.js'
|
|
7
|
-
import { DeploymentToolsService } from './deployment-tools.service.js'
|
|
8
|
-
import { CaddyService } from './caddy.service.js'
|
|
9
7
|
|
|
10
8
|
const [_, __, command, ...restArgs] = process.argv
|
|
11
9
|
|
|
@@ -21,21 +19,6 @@ const startHandler = () => {
|
|
|
21
19
|
return console.error('Deployment tools do not support this os')
|
|
22
20
|
}
|
|
23
21
|
|
|
24
|
-
CaddyService.install()
|
|
25
|
-
DeploymentToolsService.install()
|
|
26
|
-
|
|
27
|
-
exec('systemctl daemon-reload')
|
|
28
|
-
|
|
29
|
-
CaddyService.enable()
|
|
30
|
-
DeploymentToolsService.enable()
|
|
31
|
-
|
|
32
|
-
CaddyService.start()
|
|
33
|
-
DeploymentToolsService.start()
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const startContainerManagerHandler = () => {
|
|
38
|
-
console.log('Running start-container-manager command')
|
|
39
22
|
ContainerManagerServer.start()
|
|
40
23
|
}
|
|
41
24
|
|
|
@@ -84,9 +67,7 @@ const Commands = {
|
|
|
84
67
|
start: startHandler,
|
|
85
68
|
stop: stopHandler,
|
|
86
69
|
status: statusHandler,
|
|
87
|
-
deploy: deployHandler
|
|
88
|
-
// internal commands
|
|
89
|
-
'start-container-manager': startContainerManagerHandler
|
|
70
|
+
deploy: deployHandler
|
|
90
71
|
}
|
|
91
72
|
|
|
92
73
|
const commandHandler = Commands[command]
|
package/src/caddy.service.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { exec } from 'child_process'
|
|
2
|
-
import { writeFileSync } from 'fs'
|
|
3
|
-
|
|
4
|
-
export const systemdServiceFile = `
|
|
5
|
-
# caddy-api.service
|
|
6
|
-
#
|
|
7
|
-
# For using Caddy with its API.
|
|
8
|
-
#
|
|
9
|
-
# This unit is "durable" in that it will automatically resume
|
|
10
|
-
# the last active configuration if the service is restarted.
|
|
11
|
-
#
|
|
12
|
-
# See https://caddyserver.com/docs/install for instructions.
|
|
13
|
-
|
|
14
|
-
[Unit]
|
|
15
|
-
Description=Caddy
|
|
16
|
-
Documentation=https://caddyserver.com/docs/
|
|
17
|
-
After=network.target network-online.target
|
|
18
|
-
Requires=network-online.target
|
|
19
|
-
|
|
20
|
-
[Service]
|
|
21
|
-
Type=notify
|
|
22
|
-
User=caddy
|
|
23
|
-
Group=caddy
|
|
24
|
-
ExecStart=/usr/bin/caddy.route53 run --environ --resume
|
|
25
|
-
TimeoutStopSec=5s
|
|
26
|
-
LimitNOFILE=1048576
|
|
27
|
-
LimitNPROC=512
|
|
28
|
-
PrivateTmp=true
|
|
29
|
-
ProtectSystem=full
|
|
30
|
-
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
31
|
-
|
|
32
|
-
[Install]
|
|
33
|
-
WantedBy=multi-user.target
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
export class CaddyService {
|
|
37
|
-
|
|
38
|
-
static install() {
|
|
39
|
-
writeFileSync('/etc/systemd/system/caddy-route53.service', systemdServiceFile)
|
|
40
|
-
|
|
41
|
-
[
|
|
42
|
-
'apt install -y debian-keyring debian-archive-keyring apt-transport-https',
|
|
43
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg',
|
|
44
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-stable.list',
|
|
45
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg',
|
|
46
|
-
'curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list',
|
|
47
|
-
'add-apt-repository ppa:longsleep/golang-backports -y',
|
|
48
|
-
'apt update',
|
|
49
|
-
'apt install caddy xcaddy golang-go -y',
|
|
50
|
-
|
|
51
|
-
// xcaddy custom build with route53 integration
|
|
52
|
-
'xcaddy build --with github.com/caddy-dns/route53',
|
|
53
|
-
// 'sudo dpkg-divert --divert /usr/bin/caddy.default --rename /usr/bin/caddy',
|
|
54
|
-
'mv ./caddy /usr/bin/caddy.route53'
|
|
55
|
-
// 'update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.default 10',
|
|
56
|
-
// 'update-alternatives --install /usr/bin/caddy caddy /usr/bin/caddy.custom 50',
|
|
57
|
-
].forEach(command => exec(command))
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
static enable() {
|
|
61
|
-
exec('systemctl enable caddy-route53.service')
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
static start() {
|
|
65
|
-
exec('systemctl start caddy-route53.service')
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { exec } from 'child_process'
|
|
2
|
-
import { writeFileSync } from 'fs'
|
|
3
|
-
|
|
4
|
-
import * as config from './config.js'
|
|
5
|
-
|
|
6
|
-
export const systemdServiceFile = `
|
|
7
|
-
[Unit]
|
|
8
|
-
Description=D
|
|
9
|
-
After=network.target caddy-route53.service
|
|
10
|
-
|
|
11
|
-
[Service]
|
|
12
|
-
Environment=DEPLOYMENT_TOOLS_DOMAIN=${config.domain}
|
|
13
|
-
Environment=DEPLOYMENT_TOOLS_ENVIRONMENT_NAME=${config.environmentName}
|
|
14
|
-
Environment=DEPLOYMENT_TOOLS_CI_SUB_DOMAIN=${config.ciSubDomain}
|
|
15
|
-
Environment=DEPLOYMENT_TOOLS_PORT=${config.port}
|
|
16
|
-
User=caddy
|
|
17
|
-
Group=caddy
|
|
18
|
-
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
19
|
-
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
20
|
-
ExecStart=/usr/bin/npx @ossy/deployment-tools start-container-manager
|
|
21
|
-
Restart=on-failure
|
|
22
|
-
|
|
23
|
-
[Install]
|
|
24
|
-
WantedBy=multi-user.target
|
|
25
|
-
`
|
|
26
|
-
|
|
27
|
-
export class DeploymentToolsService {
|
|
28
|
-
|
|
29
|
-
static install() {
|
|
30
|
-
writeFileSync('/etc/systemd/system/deployment-tools.service', systemdServiceFile)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static enable() {
|
|
34
|
-
exec('systemctl enable deployment-tools.service')
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
static start() {
|
|
38
|
-
exec('systemctl start deployment-tools.service')
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}
|