ZZ bu gisti düzenledi . Düzenlemeye git
1 file changed, 0 insertions, 0 deletions
dasel-edit.sh yeniden adlandırıldı z-dasel-edit.sh
Dosya değişiklik yapılmadan yeniden adlandırıldı
ZZ bu gisti düzenledi . Düzenlemeye git
1 file changed, 6 insertions
dasel-edit.sh(dosya oluşturuldu)
| @@ -0,0 +1,6 @@ | |||
| 1 | + | # dasel.edit: format="$1" query="$2" file="$3" | |
| 2 | + | dasel.edit() { | |
| 3 | + | local format="$1" query="$2" file="$3" | |
| 4 | + | dasel -i "$format" --root "$query" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" | |
| 5 | + | } | |
| 6 | + | # --- | |
ZZ bu gisti düzenledi . Düzenlemeye git
Değişiklik yok
ZZ bu gisti düzenledi . Düzenlemeye git
1 file changed, 148 insertions
pango-install.sh(dosya oluşturuldu)
| @@ -0,0 +1,148 @@ | |||
| 1 | + | # pango.install: $app_domain $app_port | |
| 2 | + | pango.install(){ | |
| 3 | + | ||
| 4 | + | # Config # | |
| 5 | + | app_name="pango" # App Name | |
| 6 | + | app_repo_url="https://github.com/fosrl/pangolin" # App Codebase | |
| 7 | + | app_version="latest" | |
| 8 | + | ||
| 9 | + | app_domain="${1:-"$app_name.$org_domain"}" # Unique app domain | |
| 10 | + | app_port="${2:-"3030"}" # App Port | |
| 11 | + | api_port="$((app_port + 1))" | |
| 12 | + | api2_port="$((app_port + 2))" | |
| 13 | + | ||
| 14 | + | container_name="$app_name-$app_port" | |
| 15 | + | app_name_domain="$(echo $app_domain | tr "." "-")" | |
| 16 | + | app_path="/data/${app_name_domain}" | |
| 17 | + | app_container_config="$app_path/docker-compose.yml" | |
| 18 | + | ||
| 19 | + | # Setup paths # | |
| 20 | + | mkdir -p "$app_path" | |
| 21 | + | ||
| 22 | + | echo cd "$app_path" | |
| 23 | + | cd "$app_path" | |
| 24 | + | if [ ! $? == "0" ];then | |
| 25 | + | err "Failed to cd \"$app_path\"" | |
| 26 | + | return 1 | |
| 27 | + | fi | |
| 28 | + | ||
| 29 | + | # if file exists | |
| 30 | + | if [[ ! -e "installer" ]];then | |
| 31 | + | # not exists | |
| 32 | + | echo Downloading Installer | |
| 33 | + | curl -fsSL https://static.pangolin.net/get-installer.sh | bash | |
| 34 | + | fi | |
| 35 | + | ||
| 36 | + | if [[ ! -d "config" ]];then | |
| 37 | + | echo Running Installer | |
| 38 | + | ./installer | |
| 39 | + | fi | |
| 40 | + | ||
| 41 | + | # Write docker-compose config | |
| 42 | + | tee "$app_container_config" > /dev/null <<EOF | |
| 43 | + | name: $app_name | |
| 44 | + | services: | |
| 45 | + | $app_name: | |
| 46 | + | container_name: $container_name | |
| 47 | + | image: docker.io/fosrl/pangolin:1.20.0 | |
| 48 | + | restart: always | |
| 49 | + | deploy: | |
| 50 | + | resources: | |
| 51 | + | limits: | |
| 52 | + | memory: 2g | |
| 53 | + | reservations: | |
| 54 | + | memory: 512m | |
| 55 | + | ports: | |
| 56 | + | - $app_port:3002 | |
| 57 | + | - $api_port:3000 | |
| 58 | + | - $api2_port:3001 | |
| 59 | + | volumes: | |
| 60 | + | - ./config:/app/config | |
| 61 | + | healthcheck: | |
| 62 | + | test: ["CMD", "curl", "-f", "http://localhost:3001/api/v1/"] | |
| 63 | + | interval: "10s" | |
| 64 | + | timeout: "10s" | |
| 65 | + | retries: 15 | |
| 66 | + | extra_hosts: | |
| 67 | + | - "host.docker.internal:host-gateway" | |
| 68 | + | ||
| 69 | + | gerbil: | |
| 70 | + | image: docker.io/fosrl/gerbil:1.4.2 | |
| 71 | + | container_name: gerbil | |
| 72 | + | restart: always | |
| 73 | + | depends_on: | |
| 74 | + | $app_name: | |
| 75 | + | condition: service_healthy | |
| 76 | + | command: | |
| 77 | + | - --reachableAt=http://gerbil:3004 | |
| 78 | + | - --generateAndSaveKeyTo=/var/config/key | |
| 79 | + | - --remoteConfig=http://$app_name:3001/api/v1/ | |
| 80 | + | volumes: | |
| 81 | + | - ./config/:/var/config | |
| 82 | + | cap_add: | |
| 83 | + | - NET_ADMIN | |
| 84 | + | - SYS_MODULE | |
| 85 | + | ports: | |
| 86 | + | - 21820:21820/udp | |
| 87 | + | - 51800:51800/udp | |
| 88 | + | #- 443:443 | |
| 89 | + | #- 443:443/udp # For http3 QUIC if desired | |
| 90 | + | #- 80:80 | |
| 91 | + | networks: | |
| 92 | + | default: | |
| 93 | + | driver: bridge | |
| 94 | + | name: pangolin_frontend | |
| 95 | + | EOF | |
| 96 | + | ||
| 97 | + | caddy_domain="domain.com" | |
| 98 | + | caddy_email="your@email.com" | |
| 99 | + | caddy_ip="your_ip" | |
| 100 | + | ||
| 101 | + | cat <<EOF | |
| 102 | + | # Caddy Config: | |
| 103 | + | $caddy_domain { | |
| 104 | + | encode gzip | |
| 105 | + | tls $caddy_email | |
| 106 | + | ||
| 107 | + | # 3030 Web | |
| 108 | + | handle { | |
| 109 | + | reverse_proxy $caddy_ip:3030 | |
| 110 | + | } | |
| 111 | + | ||
| 112 | + | # 3031 API | |
| 113 | + | handle_path /api/* { | |
| 114 | + | rewrite * /api{uri} | |
| 115 | + | reverse_proxy $caddy_ip:3031 | |
| 116 | + | } | |
| 117 | + | ||
| 118 | + | # 3032 API Docs | |
| 119 | + | handle_path /api2/* { | |
| 120 | + | rewrite * /api2{uri} | |
| 121 | + | reverse_proxy $caddy_ip:3032 | |
| 122 | + | } | |
| 123 | + | } | |
| 124 | + | # --- | |
| 125 | + | EOF | |
| 126 | + | ||
| 127 | + | #dasel -i yaml --root 'app.telemetry.anonymous_usage = false' < config.yml > config.yml | |
| 128 | + | #dasel -i yaml --root 'gerbil.start_port = 51800' < config.yml > config.yml | |
| 129 | + | dasel.edit yaml 'app.telemetry.anonymous_usage = false' "$app_path/config/config.yml" | |
| 130 | + | dasel.edit yaml 'gerbil.start_port = 51800' "$app_path/config/config.yml" | |
| 131 | + | dasel.edit yaml '{$root..., "flags": {flags..., "disable_enterprise_features": true}}' "$app_path/config/config.yml" | |
| 132 | + | ||
| 133 | + | # Run App. LIVE! | |
| 134 | + | echo Running $app_name container in the background. | |
| 135 | + | ||
| 136 | + | echo sudo docker-compose pull | |
| 137 | + | sudo docker-compose pull | |
| 138 | + | ||
| 139 | + | echo sudo docker-compose down | |
| 140 | + | sudo docker-compose down | |
| 141 | + | ||
| 142 | + | echo sudo docker-compose up -d | |
| 143 | + | sudo docker-compose up -d | |
| 144 | + | ||
| 145 | + | echo open http://$(host.ip):$app_port | |
| 146 | + | ||
| 147 | + | } | |
| 148 | + | # --- | |