Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lyj0309 committed May 23, 2022
0 parents commit 9b61500
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Fly Deploy
on:
push:
schedule:
- cron: '30 20 * * *'


env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: echo '${{ secrets.CONFIG }}' > ./config.yaml

- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/litestream.yml
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ghcr.io/naiba/nezha-dashboard:latest
# RUN apk --no-cache --no-progress add openssh-client

# ADD https://github.com/benbjohnson/litestream/releases/download/v0.3.8/litestream-v0.3.8-linux-amd64-static.tar.gz /tmp/litestream.tar.gz
# RUN tar -C /usr/local/bin -xzf /tmp/litestream.tar.gz && rm /tmp/litestream.tar.g
# COPY etc/litestream.yml /etc/litestream.yml

COPY config.yaml .
COPY run.sh .
ENTRYPOINT ["./run.sh"]
64 changes: 64 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# fly.toml file generated for testnz on 2022-05-22T20:58:35+08:00

app = "testnz"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
[mounts]
source="nztest_data"
destination="/dashboard/data"

[experimental]
allowed_public_ports = []
auto_rollback = true


[[services]]
http_checks = []
internal_port = 80
processes = ["app"]
protocol = "tcp"
script_checks = []

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
handlers = ["http"]
port = 80

[[services.ports]]
handlers = ["tls", "http"]
port = 443

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"

[[services]]
http_checks = []
internal_port = 5555
processes = ["app"]
protocol = "tcp"
script_checks = []

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
port = 5555

[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
22 changes: 22 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh
echo -e "nameserver 127.0.0.11\nnameserver 8.8.8.8\nnameserver 223.5.5.5\n" > /etc/resolv.conf

if [ -f /dashboard/data/config.yaml ]; then
echo "配置文件存在,跳过配置"
else
echo "配置文件不存在,初始化默认配置"
cp /dashboard/config.yaml /dashboard/data/config.yaml
fi

# Restore the database if it does not already exist.
# if [ -f /data/db ]; then
# echo "Database already exists, skipping restore"
# else
# echo "No database found, restoring from replica if exists"
# litestream restore -v -if-replica-exists -o /data/db "${REPLICA_URL}"
# fi

# # Run litestream with your app as the subprocess.
# exec litestream replicate -exec "/usr/local/bin/myapp -dsn /data/db"

/dashboard/app

0 comments on commit 9b61500

Please sign in to comment.