Add open-rc config and woodpecker build

This commit is contained in:
Michał Gdula 2025-03-31 13:57:13 +01:00
parent 08ab662210
commit d205cffca1
2 changed files with 63 additions and 0 deletions

25
.woodpecker/pipeline.yaml Normal file
View file

@ -0,0 +1,25 @@
when:
- event: push
branch: main
steps:
- name: build
image: golang:1.24-alpine3.20
commands:
- go mod tidy
- go build .
- name: deploy
image: alpine:latest
commands:
- apk add --no-cache openssh-client
- mkdir -p ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.0.44 "rm $COPY_TO || true"
- scp -o StrictHostKeyChecking=no $COPY_FROM uncertainty@192.168.0.44:$COPY_TO
- ssh -o StrictHostKeyChecking=no uncertainty@192.168.0.44 "doas service lynxie restart"
environment:
COPY_FROM: lynxie
COPY_TO: /home/uncertainty/lynxie
SSH_KEY:
from_secret: ssh_key

38
rc-service Normal file
View file

@ -0,0 +1,38 @@
#!/sbin/openrc-run
LYNXIE_USER="uncertainty"
LYNXIE_CMD="/home/uncertainty/lynxie"
APP_NAME="lynxie"
command="$LYNXIE_CMD"
command_args=""
command_user="$LYNXIE_USER"
pidfile="/var/run/${APP_NAME}.pid"
output_log="/var/log/${APP_NAME}.log"
error_log="/var/log/${APP_NAME}_error.log"
depend() {
need net
}
start() {
ebegin "Starting ${APP_NAME}"
export E621_USERNAME=""
export E621_PASSWORD=""
export TOKEN=""
start-stop-daemon --start --user "$LYNXIE_USER" \
--make-pidfile --pidfile "$pidfile" \
--exec "$command" -- $command_args >> "$output_log" 2>> "$error_log" &
eend $?
}
stop() {
ebegin "Stopping ${APP_NAME}"
start-stop-daemon --stop --pidfile "$pidfile"
eend $?
}