Compare commits
No commits in common. "4bea6229022caff8ba8adeb0e985926c511af602" and "1d1250a3e07df7f8fe1b07e7e65bb502c04652ca" have entirely different histories.
4bea622902
...
1d1250a3e0
6 changed files with 17 additions and 36 deletions
|
@ -6,7 +6,7 @@ begin
|
||||||
function configureSW -V dir
|
function configureSW -V dir
|
||||||
source "$dir/../bash/profile.fish"
|
source "$dir/../bash/profile.fish"
|
||||||
source "$dir/../fish/profile.fish"
|
source "$dir/../fish/profile.fish"
|
||||||
set -l file (pwsh -NoProfile -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1")
|
set -l file (pwsh -CommandWithArgs '. $args[0]; Get-GlobalConfigPath' "$dir/Constants.ps1")
|
||||||
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
sudo install -Dm644 "$dir/aliae.yml" "$file"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
|
@ -24,7 +24,7 @@ services:
|
||||||
- ./data/forgejo:/data
|
- ./data/forgejo:/data
|
||||||
- config:/data/gitea/conf
|
- config:/data/gitea/conf
|
||||||
- /etc/timezone:/etc/timezone:ro
|
- /etc/timezone:/etc/timezone:ro
|
||||||
- /srv/git/.ssh:/data/git/.ssh
|
- /home/forgejo/.ssh:/data/git/.ssh
|
||||||
db:
|
db:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#!/bin/env fish
|
#!/bin/env fish
|
||||||
begin
|
begin
|
||||||
set -l dir (status dirname)
|
set -l dir (status dirname)
|
||||||
set -l user git
|
set -l user forgejo
|
||||||
set -l domain git
|
set -l domain git
|
||||||
set -l server "$domain" ""
|
set -l server "$domain" ""
|
||||||
set -l service "forgejo"
|
set -l service $user
|
||||||
source "$dir/../service.fish"
|
source "$dir/../service.fish"
|
||||||
|
|
||||||
function getSSHPortKey -V service
|
function getSSHPortKey -V service
|
||||||
|
@ -48,9 +48,6 @@ begin
|
||||||
set -l port
|
set -l port
|
||||||
set -l file (mktemp)
|
set -l file (mktemp)
|
||||||
set -l root (getServiceRoot $argv)
|
set -l root (getServiceRoot $argv)
|
||||||
set -l home /srv/git
|
|
||||||
set -l sshDir "$home/.ssh"
|
|
||||||
set -l keyFile "$sshDir/id_rsa"
|
|
||||||
set -l dir "$root/data"
|
set -l dir "$root/data"
|
||||||
set -l bin /usr/local/bin/forgejo
|
set -l bin /usr/local/bin/forgejo
|
||||||
set -l config "$root/docker-compose.base.yml"
|
set -l config "$root/docker-compose.base.yml"
|
||||||
|
@ -63,37 +60,29 @@ begin
|
||||||
--system \
|
--system \
|
||||||
--shell /bin/bash \
|
--shell /bin/bash \
|
||||||
--comment 'Git Version Control' \
|
--comment 'Git Version Control' \
|
||||||
|
--create-home \
|
||||||
$user
|
$user
|
||||||
|
|
||||||
set uid (id -u $user)
|
set uid (id -u $user)
|
||||||
set gid (id -g $user)
|
set gid (id -g $user)
|
||||||
and sudo usermod -d "$home" "$user"
|
|
||||||
|
|
||||||
and yq "$envKey.USER_UID = $uid" "$file" |
|
and yq "$envKey.USER_UID = $uid" "$file" |
|
||||||
yq "$envKey.USER_GID = $gid" |
|
yq "$envKey.USER_GID = $gid" |
|
||||||
sudo tee "$config" >/dev/null
|
sudo tee "$config" >/dev/null
|
||||||
|
|
||||||
rm "$file"
|
sudo mkdir -p "$dir"
|
||||||
|
|
||||||
and sudo mkdir -p "$dir"
|
|
||||||
and sudo mkdir -p "$home"
|
|
||||||
and sudo chown -R $uid:$gid "$dir"
|
and sudo chown -R $uid:$gid "$dir"
|
||||||
and sudo chown -R $uid:$gid "$home"
|
rm "$file"
|
||||||
and sudo -u "#$uid" mkdir -p "$sshDir"
|
|
||||||
and sudo -u "#$uid" ssh-keygen -t rsa -b 4096 -C "Forgejo Host Key" -f "$keyFile" -N ""
|
|
||||||
and sudo -u "#$uid" cat "$keyFile.pub" | sudo -u "#$uid" tee -a "$sshDir/authorized_keys"
|
|
||||||
and sudo chmod 600 "$sshDir/authorized_keys"
|
|
||||||
|
|
||||||
set port (yq (getSSHPortKey) "$overrides" | extractPort)
|
set port (yq (getSSHPortKey) "$overrides" | extractPort)
|
||||||
|
|
||||||
begin
|
begin
|
||||||
printf "%s\n" \
|
printf "%s\n" \
|
||||||
"#!/bin/sh" \
|
"#!/bin/sh" \
|
||||||
"ssh -p $port -o StrictHostKeyChecking=no git@127.0.0.1 \"SSH_ORIGINAL_COMMAND=\\\"\$SSH_ORIGINAL_COMMAND\\\" \$0 \$@\""
|
"ssh -p $port -o StrictHostKeyChecking=no git@127.0.0.1 \"SSH_ORIGINAL_COMMAND=\\\"$SSH_ORIGINAL_COMMAND\\\" \$0 \$@\""
|
||||||
end | sudo tee "$bin" >/dev/null
|
end | sudo tee "$bin" >/dev/null
|
||||||
|
|
||||||
sudo chmod +x "$bin"
|
sudo chmod +x "$bin"
|
||||||
sudo ln -s "$bin" "$(dirname "$bin")/gitea"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function getServiceServers -V server
|
function getServiceServers -V server
|
||||||
|
|
|
@ -83,7 +83,6 @@ begin
|
||||||
"$_flag_name" / "" (
|
"$_flag_name" / "" (
|
||||||
for app in $servarr
|
for app in $servarr
|
||||||
printf "%s\n" "$app" "/$app" ""
|
printf "%s\n" "$app" "/$app" ""
|
||||||
printf "%s\n" "$app" "/$app/signalr" ""
|
|
||||||
end) \
|
end) \
|
||||||
flood "/flood/"
|
flood "/flood/"
|
||||||
end
|
end
|
||||||
|
@ -108,29 +107,22 @@ begin
|
||||||
'return 302 $scheme://$host$uri/$is_args$args;' \
|
'return 302 $scheme://$host$uri/$is_args$args;' \
|
||||||
"}"
|
"}"
|
||||||
else
|
else
|
||||||
getServiceDefaultProxy $argv
|
getServiceDefaultProxy $argv --path "$location"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function getExtraLocationSettings -a domain s location -V service -V servarr
|
function getExtraLocationSettings -a domain s location -V service
|
||||||
set -l wsConfig (
|
|
||||||
printf "%s\n" \
|
|
||||||
'# Websocket' \
|
|
||||||
"proxy_http_version 1.1;" \
|
|
||||||
'proxy_set_header Upgrade $http_upgrade;' \
|
|
||||||
'proxy_set_header Connection "upgrade";')
|
|
||||||
|
|
||||||
if [ "$s" = "$service" ]
|
if [ "$s" = "$service" ]
|
||||||
if [ "$location" = / ]
|
if [ "$location" = / ]
|
||||||
printf "%s\n" \
|
printf "%s\n" \
|
||||||
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
|
"# Disable buffering when the nginx proxy gets very resource heavy upon streaming" \
|
||||||
"proxy_buffering off;"
|
"proxy_buffering off;"
|
||||||
else if [ "$location" = /socket ]
|
else if [ "$location" = /socket ]
|
||||||
echo "$wsConfig"
|
printf "%s\n" \
|
||||||
end
|
'# Websocket' \
|
||||||
else if contains "$s" $servarr
|
"proxy_http_version 1.1;" \
|
||||||
if string match --regex ".*/signalr^" "$location" >/dev/null
|
'proxy_set_header Upgrade $http_upgrade;' \
|
||||||
echo "$wsConfig"
|
'proxy_set_header Connection "upgrade";'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,7 +8,7 @@ begin
|
||||||
set -l file (mktemp)
|
set -l file (mktemp)
|
||||||
|
|
||||||
if [ -z "$title" ]
|
if [ -z "$title" ]
|
||||||
set title "$name"
|
set -l title "$name"
|
||||||
end
|
end
|
||||||
|
|
||||||
if [ -z "$content" ]
|
if [ -z "$content" ]
|
||||||
|
|
|
@ -73,7 +73,7 @@ begin
|
||||||
set _flag_script $argv[1]
|
set _flag_script $argv[1]
|
||||||
end
|
end
|
||||||
|
|
||||||
pwsh -NoProfile -CommandWithArgs '& $args[0] $args[1] @{ name=$args[2]; }' "$_flag_script" "$_flag_action" "$_flag_user"
|
pwsh -CommandWithArgs '& $args[0] $args[1] @{ name=$args[2]; }' "$_flag_script" "$_flag_action" "$_flag_user"
|
||||||
end
|
end
|
||||||
|
|
||||||
function runPSUserConfig
|
function runPSUserConfig
|
||||||
|
|
Loading…
Reference in a new issue