-
-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathdeploy.vsh
More file actions
executable file
·36 lines (29 loc) · 923 Bytes
/
deploy.vsh
File metadata and controls
executable file
·36 lines (29 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env -S v run
import os
import term
const server = 'gitly'
const remote_path = '/var/www/gitly'
fn main() {
println('Step 1: Syncing files...')
// -a: archive mode (preserves permissions, recursive, etc.)
// -v: verbose
// -z: compress
exec_safe('rsync -avz src translations ${server}:${remote_path}/')
println('\nStep 2: Remote compilation and restart...')
remote_cmds := [
'cd ${remote_path}',
'/root/v2/v -keepc -d trace_pg_error -d new_veb -d use_openssl .',
'sudo systemctl restart gitly',
].join(' && ')
println('ssh ${server} "${remote_cmds}"')
exec_safe('ssh ${server} "${remote_cmds}"')
println(term.green('\nDeployment successful!'))
}
fn exec_safe(cmd string) {
// os.system streams output directly to stdout/stderr,
// which is better for seeing rsync progress and compiler errors.
if os.system(cmd) != 0 {
eprintln(term.red('\n Error executing command.'))
exit(1)
}
}