fix: stuff
This commit is contained in:
parent
41e5fce0b2
commit
a82612b5f9
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
|
src/opengist.yml
|
||||||
src/gitea-app.ini
|
src/gitea-app.ini
|
||||||
ext
|
ext
|
||||||
|
@ -42,5 +42,6 @@ source ./020-net.sh
|
|||||||
source ./021-net-routing.sh
|
source ./021-net-routing.sh
|
||||||
source ./022-net-ssl.sh
|
source ./022-net-ssl.sh
|
||||||
source ./030-gitea-actions.sh
|
source ./030-gitea-actions.sh
|
||||||
source ./031-gitea.sh
|
source ./031-gist.sh
|
||||||
|
source ./039-gitea.sh
|
||||||
source ./999-post.sh
|
source ./999-post.sh
|
||||||
|
@ -6,14 +6,9 @@ uid_git=${uid_git:-}
|
|||||||
mkdir -p /tmp/git
|
mkdir -p /tmp/git
|
||||||
if id git &>/dev/null; then
|
if id git &>/dev/null; then
|
||||||
mkdir -p /tmp/git
|
mkdir -p /tmp/git
|
||||||
mv /home/git/data /tmp/git/data
|
mv /home/git/opengist /tmp/git/opengist || true
|
||||||
mv /home/git/config /tmp/git/config
|
mv /home/git/data /tmp/git/data || true
|
||||||
else
|
mv /home/git/config /tmp/git/config || true
|
||||||
mkdir /tmp/git
|
|
||||||
mkdir /tmp/git/data
|
|
||||||
mkdir /tmp/git/data/git
|
|
||||||
mkdir /tmp/git/data/act_runner
|
|
||||||
mkdir /tmp/git/config
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## delete and recreate `git` user
|
## delete and recreate `git` user
|
||||||
@ -28,21 +23,37 @@ useradd \
|
|||||||
--shell /bin/bash \
|
--shell /bin/bash \
|
||||||
git
|
git
|
||||||
|
|
||||||
|
mkdir -p /tmp/git/opengist/
|
||||||
|
mkdir -p /tmp/git/config/
|
||||||
|
mkdir -p /tmp/git/data/
|
||||||
|
mkdir -p /tmp/git/data/git/
|
||||||
|
mkdir -p /tmp/git/data/act_runner/
|
||||||
|
|
||||||
read -rp "enter public ssh key allowing sessions as \`git\`:" git_ssh_pub
|
read -rp "enter public ssh key allowing sessions as \`git\`:" git_ssh_pub
|
||||||
user_init git "$git_ssh_pub"
|
user_init git "$git_ssh_pub"
|
||||||
|
|
||||||
## restore homedir
|
## restore homedir (if applicable)
|
||||||
mv /tmp/git/data /home/git/
|
if [ -d /tmp/git/data ]; then
|
||||||
mv /tmp/git/config /home/git/
|
mv /tmp/git/data /home/git/ || true
|
||||||
|
mv /tmp/git/config /home/git/ || true
|
||||||
|
mv /tmp/git/opengist /home/git/ || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
## gitea
|
||||||
cp ./gitea-docker-compose.yml /home/git/docker-compose.yml
|
cp ./gitea-docker-compose.yml /home/git/docker-compose.yml
|
||||||
cp ./gitea-app.ini /home/git/config/app.ini
|
cp ./gitea-app.ini /home/git/config/app.ini
|
||||||
sed -i "s/\\\${{TIMESTAMP}}/$(date +%s)/g" /home/git/config/app.ini
|
sed -i "s/\\\${{TIMESTAMP}}/$(date +%s)/g" /home/git/config/app.ini
|
||||||
|
|
||||||
|
## runner
|
||||||
touch /home/git/runner-config.yml
|
touch /home/git/runner-config.yml
|
||||||
touch /home/git/.env.runner
|
touch /home/git/.env.runner
|
||||||
|
|
||||||
|
## gist
|
||||||
|
touch /home/git/opengist.yml
|
||||||
|
|
||||||
|
## ownership & permissions
|
||||||
chown -R git:git /home/git
|
chown -R git:git /home/git
|
||||||
|
chown -R git:git /home/git/opengist.yml
|
||||||
chown -R git:git /home/git/runner-config.yml
|
chown -R git:git /home/git/runner-config.yml
|
||||||
chown -R git:git /home/git/.env.runner
|
chown -R git:git /home/git/.env.runner
|
||||||
chown -R git:git /home/git/data
|
chown -R git:git /home/git/data
|
||||||
@ -50,5 +61,6 @@ chown -R git:git /home/git/data/git
|
|||||||
chown -R git:git /home/git/data/act_runner
|
chown -R git:git /home/git/data/act_runner
|
||||||
chown -R git:git /home/git/config
|
chown -R git:git /home/git/config
|
||||||
|
|
||||||
|
chmod -R 777 /home/git/opengist
|
||||||
chmod -R 777 /home/git/data
|
chmod -R 777 /home/git/data
|
||||||
chmod -R 777 /home/git/config
|
chmod -R 777 /home/git/config
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#! /usr/bin/bash
|
#! /usr/bin/bash
|
||||||
|
|
||||||
domain_root=${domain_root:-}
|
domain_root=${domain_root:-}
|
||||||
|
git_domain="git.$domain_root"
|
||||||
|
gist_domain="gist.$domain_root"
|
||||||
|
|
||||||
mkdir -p /etc/nginx/sites-available
|
mkdir -p /etc/nginx/sites-available
|
||||||
mkdir -p /etc/nginx/sites-enabled
|
mkdir -p /etc/nginx/sites-enabled
|
||||||
@ -8,11 +10,25 @@ mkdir -p /etc/nginx/sites-enabled
|
|||||||
rm -r "/etc/nginx/sites-available/$domain_root" 2>/dev/null || true
|
rm -r "/etc/nginx/sites-available/$domain_root" 2>/dev/null || true
|
||||||
rm -r "/etc/nginx/sites-enabled/$domain_root" 2>/dev/null || true
|
rm -r "/etc/nginx/sites-enabled/$domain_root" 2>/dev/null || true
|
||||||
|
|
||||||
touch "/etc/nginx/sites-available/$domain_root"
|
# git.<domain>
|
||||||
ln -s "/etc/nginx/sites-available/$domain_root" "/etc/nginx/sites-enabled/$domain_root"
|
rm -r "/etc/nginx/sites-available/$git_domain" 2>/dev/null || true
|
||||||
|
rm -r "/etc/nginx/sites-enabled/$git_domain" 2>/dev/null || true
|
||||||
|
|
||||||
cp ./nginx.conf "/etc/nginx/sites-available/$domain_root"
|
touch "/etc/nginx/sites-available/$git_domain"
|
||||||
chmod 777 "/etc/nginx/sites-available/$domain_root"
|
ln -s "/etc/nginx/sites-available/$git_domain" "/etc/nginx/sites-enabled/$git_domain"
|
||||||
|
|
||||||
|
cp ./git.orionkindel.com.nginx.conf "/etc/nginx/sites-available/$git_domain"
|
||||||
|
chmod 777 "/etc/nginx/sites-available/$git_domain"
|
||||||
|
|
||||||
|
# gist.<domain>
|
||||||
|
rm -r "/etc/nginx/sites-available/$gist_domain" 2>/dev/null || true
|
||||||
|
rm -r "/etc/nginx/sites-enabled/$gist_domain" 2>/dev/null || true
|
||||||
|
|
||||||
|
touch "/etc/nginx/sites-available/$gist_domain"
|
||||||
|
ln -s "/etc/nginx/sites-available/$gist_domain" "/etc/nginx/sites-enabled/$gist_domain"
|
||||||
|
|
||||||
|
cp ./gist.orionkindel.com.nginx.conf "/etc/nginx/sites-available/$gist_domain"
|
||||||
|
chmod 777 "/etc/nginx/sites-available/$gist_domain"
|
||||||
|
|
||||||
systemctl enable nginx
|
systemctl enable nginx
|
||||||
systemctl start nginx
|
systemctl start nginx
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
#! /usr/bin/bash
|
#! /usr/bin/bash
|
||||||
|
|
||||||
certbot --nginx -d git.orionkindel.com -n
|
certbot --nginx -d git.orionkindel.com -n
|
||||||
|
certbot --nginx -d gist.orionkindel.com -n
|
||||||
|
9
src/031-gist.sh
Normal file
9
src/031-gist.sh
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#! /usr/bin/bash
|
||||||
|
|
||||||
|
cp ./opengist.yml /home/git/opengist.yml
|
||||||
|
chown git:git -R /home/git/opengist.yml
|
||||||
|
|
||||||
|
cp ./opengist-embed.html /home/git/opengist.embed.html
|
||||||
|
chown git:git -R /home/git/opengist.embed.html
|
||||||
|
|
||||||
|
echo "Follow https://github.com/thomiceli/opengist#configure-oauth, enter secrets in opengist.yml then re-run this script to enable gist server"
|
@ -17,7 +17,7 @@ rm /usr/local/bin/gitea-shell || true;
|
|||||||
|
|
||||||
cat << "EOF" >> /usr/local/bin/gitea-shell
|
cat << "EOF" >> /usr/local/bin/gitea-shell
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
/usr/bin/docker compose exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" server sh "$@"
|
/usr/bin/docker compose exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
chmod +x /usr/local/bin/gitea-shell
|
chmod +x /usr/local/bin/gitea-shell
|
17
src/gist.orionkindel.com.nginx.conf
Normal file
17
src/gist.orionkindel.com.nginx.conf
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
server {
|
||||||
|
listen 80;
|
||||||
|
server_name gist.orionkindel.com;
|
||||||
|
|
||||||
|
location ~ ^/embed(/.*)$ {
|
||||||
|
root /home/git;
|
||||||
|
try_files /opengist.embed.html =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://localhost:8881;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
proxy_set_header X-Forwarded-Proto $scheme;
|
||||||
|
}
|
||||||
|
}
|
@ -11,9 +11,7 @@ runner:
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
enabled: true
|
enabled: true
|
||||||
dir: "/data/.cache"
|
host: "152.44.36.48"
|
||||||
host: ""
|
|
||||||
port: 0
|
|
||||||
|
|
||||||
container:
|
container:
|
||||||
network_mode: bridge
|
network_mode: bridge
|
||||||
|
@ -3,9 +3,9 @@ version: "3"
|
|||||||
name: gitea_compose
|
name: gitea_compose
|
||||||
|
|
||||||
services:
|
services:
|
||||||
server:
|
gitea:
|
||||||
image: gitea/gitea:latest-rootless
|
|
||||||
container_name: gitea
|
container_name: gitea
|
||||||
|
image: gitea/gitea:latest-rootless
|
||||||
user: "1000"
|
user: "1000"
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
@ -17,14 +17,27 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "8880:3000" # see also: ./nginx.conf
|
- "8880:3000" # see also: ./nginx.conf
|
||||||
- "127.0.0.1:2222:22"
|
- "127.0.0.1:2222:22"
|
||||||
runner:
|
|
||||||
image: toadlib/act_runner:latest
|
gitea_runner:
|
||||||
|
container_name: gitea_runner
|
||||||
|
image: gitea/act_runner:latest
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- server
|
- gitea
|
||||||
volumes:
|
volumes:
|
||||||
- /home/git/data/act_runner:/data
|
- /home/git/data/act_runner:/data
|
||||||
- /home/git/runner-config.yml:/config.yml
|
- /home/git/runner-config.yml:/config.yml
|
||||||
- /run/user/1000/docker.sock:/var/run/docker.sock
|
- /run/user/1000/docker.sock:/var/run/docker.sock
|
||||||
env_file:
|
env_file:
|
||||||
- /home/git/.env.runner
|
- /home/git/.env.runner
|
||||||
|
|
||||||
|
opengist:
|
||||||
|
container_name: opengist
|
||||||
|
image: ghcr.io/thomiceli/opengist:1
|
||||||
|
command: ['./opengist', '--config', '/root/opengist.yml']
|
||||||
|
restart: always
|
||||||
|
volumes:
|
||||||
|
- "/home/git/opengist:/root/.opengist"
|
||||||
|
- "/home/git/opengist.yml:/root/opengist.yml"
|
||||||
|
ports:
|
||||||
|
- "8881:6157" # http
|
||||||
|
16
src/opengist-embed.html
Normal file
16
src/opengist-embed.html
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
const href = window.location.href.replace('embed/', '');
|
||||||
|
const file = window.location.hash;
|
||||||
|
const iframe = document.createElement('iframe');
|
||||||
|
iframe.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; border: none; outline: none;');
|
||||||
|
iframe.onload = () => {
|
||||||
|
const files = iframe.contentDocument.querySelectorAll('div.grid > div');
|
||||||
|
const fileDiv = Array.from(files).find(f => f.querySelector('span' + file) !== undefined);
|
||||||
|
fileDiv.setAttribute('style', 'position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: white;');
|
||||||
|
iframe.contentDocument.body.setAttribute('style', 'overflow: hidden;')
|
||||||
|
}
|
||||||
|
iframe.src = href;
|
||||||
|
document.body.append(iframe);
|
||||||
|
</script>
|
||||||
|
</body>
|
8
src/opengist.example.yml
Normal file
8
src/opengist.example.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
log-level: info
|
||||||
|
ssh.git-enabled: false
|
||||||
|
|
||||||
|
# Fill these in
|
||||||
|
# https://github.com/thomiceli/opengist#configure-oauth
|
||||||
|
gitea.client-key:
|
||||||
|
gitea.secret:
|
||||||
|
gitea.url:
|
Loading…
Reference in New Issue
Block a user