-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Assuming: | ||
# - Source code located at: /home/duyet/project/clickhouse-monitoring | ||
# - NVM installed, NODE_VERSION=v22.5.1 | ||
# - Port 3000 is available | ||
# | ||
# Put this file at: /etc/systemd/system/clickhouse-monitoring.service | ||
# | ||
# sudo systemctl enable clickhouse-monitoring.service | ||
# sudo systemctl daemon-reload | ||
# sudo systemctl start clickhouse-monitoring.service | ||
# sudo systemctl status clickhouse-monitoring.service | ||
|
||
[Unit] | ||
Description=ClickHouse Monitoring | ||
|
||
[Service] | ||
Restart=always | ||
RestartSec=3 | ||
Environment=NODE_VERSION=v22.5.1 | ||
WorkingDirectory=/home/duyet/project/clickhouse-monitoring | ||
# ExecStartPre=/home/duyet/.nvm/nvm-exec yarn build | ||
ExecStart=/home/duyet/.nvm/nvm-exec yarn start -H 0.0.0.0 -p 3000 | ||
Type=simple | ||
StandardOutput=append:/var/log/clickhouse-monitoring/clickhouse-monitoring.log | ||
StandardError=app-end:/var/log/clickhouse-monitoring/clickhouse-monitoring.err | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Homelab Deploy | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- published | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
jobs: | ||
homelab-deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
USER: duyet | ||
MACHINE: duet-ubuntu | ||
# Generate key to get a private key to add to GitHub: ssh-keygen -t ed25519 | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
steps: | ||
- name: Tailscale | ||
uses: tailscale/github-action@v2 | ||
with: | ||
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }} | ||
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }} | ||
tags: tag:ci | ||
|
||
- run: | | ||
mkdir -p ~/.ssh/ | ||
chmod 0700 ~/.ssh | ||
eval $(ssh-agent -s) | ||
ssh-add <(echo "$SSH_KEY") | ||
MACHINE_IP="$(tailscale ip -6 $MACHINE)" | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $USER@$MACHINE_IP "NODE_VERSION=v22.5.1 /home/duyet/.nvm/nvm-exec yarn build" | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $USER@$MACHINE_IP "sudo systemctl restart clickhouse-monitoring.service" |