Last active 1732827231

renich's Avatar renich revised this gist 1732827231. Go to revision

1 file changed, 1 insertion, 1 deletion

opengist-install.bash

@@ -1,7 +1,7 @@
1 1 #!/usr/bin/bash
2 2
3 3 # Description:
4 - # This script is for installing pengist. To use it, you need to execute it with a version as an argument
4 + # This script is for installing opengist. To use it, you need to execute it with a version as an argument
5 5 #
6 6 # For example:
7 7 #

renich's Avatar renich revised this gist 1732827076. Go to revision

1 file changed, 90 deletions

forgejo-runner-install.bash (file deleted)

@@ -1,90 +0,0 @@
1 - #!/usr/bin/bash
2 - set -x
3 -
4 - # Description:
5 - # This script is for installing pengist. To use it, you need to execute it with a version as an argument
6 - #
7 - # For example:
8 - #
9 - # forgejo-runner-install 5.0.3
10 -
11 - # functions
12 - # example: rm / || die 'It didn't work!' 2
13 - die() {
14 - local message=$1
15 - local code=$2
16 -
17 - echo -e "Error: $1"
18 - exit $2
19 - }
20 -
21 -
22 - version=$1
23 - url="https://code.forgejo.org/forgejo/runner/releases/download/v$version/forgejo-runner-$version-linux-amd64"
24 - binary="forgejo-runner-$version-linux-amd64"
25 -
26 - # check if version was provided
27 - if [[ -z $version ]]; then
28 - die "You didn't provide a version to install. Please, provide one similar to: a.b.c" 1
29 - fi
30 -
31 - if ! command -v podman &> /dev/null; then
32 - die "Podman is not installed. Please, install it and reboot before proceeding." 2
33 - fi
34 -
35 - # download and symlink
36 - cd /usr/local/bin
37 - curl -LO "$url"
38 - ln -fs $binary forgejo-runner
39 - cd -
40 -
41 - # fix perms
42 - chmod 755 /usr/local/bin/$binary
43 -
44 - # create user
45 - if ! id -u forgejo-runner; then
46 - useradd -mr -d /var/lib/forgejo-runner forgejo-runner
47 -
48 - # enable podman
49 - systemctl --user -M forgejo-runner@ enable --now podman.socket
50 -
51 - # enable linger
52 - loginctl enable-linger
53 -
54 - # create systemd service
55 - user_home=$( sudo -iu forgejo-runner pwd )
56 - user_service_path=$user_home/.config/systemd/user
57 - sudo -u forgejo-runner mkdir -p $user_service_path
58 -
59 - if [[ ! -f $user_service_path/forgejo-runner.service ]]; then
60 - cat <<- 'EOF' | sudo -u forgejo-runner tee $user_service_path/forgejo-runner.service
61 - [Unit]
62 - Description=Forgejo Runner
63 - Documentation=https://forgejo.org/docs/latest/admin/actions/
64 -
65 - [Service]
66 - ExecStart=forgejo-runner daemon
67 - ExecReload=/bin/kill -s HUP $MAINPID
68 - WorkingDirectory=/var/lib/forgejo-runner
69 - Restart=on-failure
70 - TimeoutSec=0
71 - RestartSec=10
72 -
73 - [Install]
74 - WantedBy=multi-user.target
75 - EOF
76 -
77 - # activate service
78 - systemctl --user -M forgejo-runner@ daemon-reload
79 - systemctl --user -M forgejo-runner@ enable --now forgejo-runner.service
80 - else
81 - # reload
82 - systemctl --user -M forgejo-runner@ reload forgejo-runner.service
83 - fi
84 - fi
85 -
86 - # fix perms
87 - chmod -R o-rwx /var/lib/forgejo-runner
88 -
89 - # registration
90 - echo 'Now, you need to proceed registering forgejo-runner'.

renich's Avatar renich revised this gist 1732827053. Go to revision

1 file changed, 90 insertions

forgejo-runner-install.bash(file created)

@@ -0,0 +1,90 @@
1 + #!/usr/bin/bash
2 + set -x
3 +
4 + # Description:
5 + # This script is for installing pengist. To use it, you need to execute it with a version as an argument
6 + #
7 + # For example:
8 + #
9 + # forgejo-runner-install 5.0.3
10 +
11 + # functions
12 + # example: rm / || die 'It didn't work!' 2
13 + die() {
14 + local message=$1
15 + local code=$2
16 +
17 + echo -e "Error: $1"
18 + exit $2
19 + }
20 +
21 +
22 + version=$1
23 + url="https://code.forgejo.org/forgejo/runner/releases/download/v$version/forgejo-runner-$version-linux-amd64"
24 + binary="forgejo-runner-$version-linux-amd64"
25 +
26 + # check if version was provided
27 + if [[ -z $version ]]; then
28 + die "You didn't provide a version to install. Please, provide one similar to: a.b.c" 1
29 + fi
30 +
31 + if ! command -v podman &> /dev/null; then
32 + die "Podman is not installed. Please, install it and reboot before proceeding." 2
33 + fi
34 +
35 + # download and symlink
36 + cd /usr/local/bin
37 + curl -LO "$url"
38 + ln -fs $binary forgejo-runner
39 + cd -
40 +
41 + # fix perms
42 + chmod 755 /usr/local/bin/$binary
43 +
44 + # create user
45 + if ! id -u forgejo-runner; then
46 + useradd -mr -d /var/lib/forgejo-runner forgejo-runner
47 +
48 + # enable podman
49 + systemctl --user -M forgejo-runner@ enable --now podman.socket
50 +
51 + # enable linger
52 + loginctl enable-linger
53 +
54 + # create systemd service
55 + user_home=$( sudo -iu forgejo-runner pwd )
56 + user_service_path=$user_home/.config/systemd/user
57 + sudo -u forgejo-runner mkdir -p $user_service_path
58 +
59 + if [[ ! -f $user_service_path/forgejo-runner.service ]]; then
60 + cat <<- 'EOF' | sudo -u forgejo-runner tee $user_service_path/forgejo-runner.service
61 + [Unit]
62 + Description=Forgejo Runner
63 + Documentation=https://forgejo.org/docs/latest/admin/actions/
64 +
65 + [Service]
66 + ExecStart=forgejo-runner daemon
67 + ExecReload=/bin/kill -s HUP $MAINPID
68 + WorkingDirectory=/var/lib/forgejo-runner
69 + Restart=on-failure
70 + TimeoutSec=0
71 + RestartSec=10
72 +
73 + [Install]
74 + WantedBy=multi-user.target
75 + EOF
76 +
77 + # activate service
78 + systemctl --user -M forgejo-runner@ daemon-reload
79 + systemctl --user -M forgejo-runner@ enable --now forgejo-runner.service
80 + else
81 + # reload
82 + systemctl --user -M forgejo-runner@ reload forgejo-runner.service
83 + fi
84 + fi
85 +
86 + # fix perms
87 + chmod -R o-rwx /var/lib/forgejo-runner
88 +
89 + # registration
90 + echo 'Now, you need to proceed registering forgejo-runner'.

renich's Avatar renich revised this gist 1732660148. Go to revision

1 file changed, 1 insertion, 1 deletion

opengist-install.bash

@@ -1,6 +1,6 @@
1 1 #!/usr/bin/bash
2 2
3 - # Descripción:
3 + # Description:
4 4 # This script is for installing pengist. To use it, you need to execute it with a version as an argument
5 5 #
6 6 # For example:

renich's Avatar renich revised this gist 1732660137. Go to revision

1 file changed, 30 insertions, 6 deletions

opengist-install.bash

@@ -1,20 +1,39 @@
1 1 #!/usr/bin/bash
2 2
3 - version=${1:-1.8.2}
3 + # Descripción:
4 + # This script is for installing pengist. To use it, you need to execute it with a version as an argument
5 + #
6 + # For example:
7 + #
8 + # opengist-install 1.18.2
9 +
10 + # functions
11 + # example: rm / || die 'It didn't work!' 2
12 + die() {
13 + local message=$1
14 + local code=$2
15 +
16 + echo -e "Error: $1"
17 + exit $2
18 + }
19 +
20 +
21 + version=$1
4 22 url="https://github.com/thomiceli/opengist/releases/download/v$version/opengist$version-linux-amd64.tar.gz"
5 23 tar_file=${url##*/}
6 24 binary="opengist$version-linux-amd64"
7 25
26 + # check if version was provided
27 + if [[ -z $version ]]; then
28 + die "You didn't provide a version to install. Please, provide one similar to: a.b.c" 1
29 + fi
30 +
8 31 # create user
9 32 if ! id -u opengist; then
10 33 useradd -mr -d /var/lib/opengist opengist
11 34
12 35 ## create config dir
13 36 mkdir -p /etc/opengist
14 -
15 - ## fix perms
16 - chown -R opengist:opengist /etc/opengist
17 - chmod 2770 $_
18 37 fi
19 38
20 39 # download
@@ -31,12 +50,17 @@ cd /usr/local/bin
31 50 ln -s $binary opengist
32 51 cd -
33 52
53 + # fix perms
54 + chown -R opengist:opengist /etc/opengist
55 + chmod 2770 $_
56 + chmod 660 $_/*
57 + chmod -R o-rwx /var/lib/opengist
58 +
34 59 # create systemd service
35 60 cat << EOF > /etc/systemd/system/opengist.service
36 61 [Unit]
37 62 Description=opengist Server
38 63 After=network.target
39 - Requires=nginx.service
40 64
41 65 [Service]
42 66 Type=simple

renich's Avatar renich revised this gist 1732659044. Go to revision

1 file changed, 54 insertions

opengist-install.bash(file created)

@@ -0,0 +1,54 @@
1 + #!/usr/bin/bash
2 +
3 + version=${1:-1.8.2}
4 + url="https://github.com/thomiceli/opengist/releases/download/v$version/opengist$version-linux-amd64.tar.gz"
5 + tar_file=${url##*/}
6 + binary="opengist$version-linux-amd64"
7 +
8 + # create user
9 + if ! id -u opengist; then
10 + useradd -mr -d /var/lib/opengist opengist
11 +
12 + ## create config dir
13 + mkdir -p /etc/opengist
14 +
15 + ## fix perms
16 + chown -R opengist:opengist /etc/opengist
17 + chmod 2770 $_
18 + fi
19 +
20 + # download
21 + curl -LO "$url"
22 +
23 + # extract binary
24 + tar -xavf "$tar_file" -C /usr/local/bin --strip-components=1 --transform="s@\$@1.8.2-linux-amd64@" opengist/opengist
25 +
26 + # extract config
27 + tar -xavf "$tar_file" -C /etc/opengist --strip-components=1 opengist/config.yml
28 +
29 + # symlink
30 + cd /usr/local/bin
31 + ln -s $binary opengist
32 + cd -
33 +
34 + # create systemd service
35 + cat << EOF > /etc/systemd/system/opengist.service
36 + [Unit]
37 + Description=opengist Server
38 + After=network.target
39 + Requires=nginx.service
40 +
41 + [Service]
42 + Type=simple
43 + User=opengist
44 + Group=opengist
45 + ExecStart=/usr/local/bin/opengist --config /etc/opengist/config.yml
46 + Restart=on-failure
47 +
48 + [Install]
49 + WantedBy=multi-user.target
50 + EOF
51 +
52 + # activate service
53 + systemctl daemon-reload
54 + systemctl enable --now opengist
Newer Older