bring simpbot deploy harness over to nunbot
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
3ce33e0185
commit
3cfe6216f2
37
.drone.yml
Normal file
37
.drone.yml
Normal file
@ -0,0 +1,37 @@
|
||||
kind: pipeline
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: golang
|
||||
commands:
|
||||
- make
|
||||
|
||||
- name: create release-source tar
|
||||
image: golang
|
||||
commands:
|
||||
- go mod vendor
|
||||
- tar -czf release-source-$DRONE_TAG.tar.gz *
|
||||
- mkdir dist
|
||||
- mv release-source-$DRONE_TAG.tar.gz dist/
|
||||
when:
|
||||
event: tag
|
||||
|
||||
- name: create release-binary tar
|
||||
image: golang
|
||||
commands:
|
||||
- tar -czf dist/release-$DRONE_TAG-$DRONE_STAGE_ARCH.tar.gz init/nunbot.service config.yaml.sample nunbot
|
||||
when:
|
||||
event: tag
|
||||
|
||||
- name: release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
files:
|
||||
- dist/*
|
||||
base_url: https://git.saintnet.tech
|
||||
when:
|
||||
event: tag
|
||||
|
6
config.yaml.sample
Normal file
6
config.yaml.sample
Normal file
@ -0,0 +1,6 @@
|
||||
homeserver: matrix.saintnet.tech
|
||||
username: NunBot
|
||||
password: nuns
|
||||
dimension: dimension.saintnet.tech
|
||||
domain: saintnet.tech
|
||||
statefile: statefile
|
52
deploy.yml
Normal file
52
deploy.yml
Normal file
@ -0,0 +1,52 @@
|
||||
---
|
||||
|
||||
- hosts: localhost
|
||||
tasks:
|
||||
- name: check nunbot version
|
||||
uri:
|
||||
url: https://git.saintnet.tech/api/v1/repos/stryan/nunbot/releases?limit=1
|
||||
return_content: true
|
||||
register: nunbot_latest
|
||||
|
||||
- name: "downloading and installing nunbot {{ nunbot_latest.json[0].tag_name }}"
|
||||
block:
|
||||
- name: create temp directory
|
||||
tempfile:
|
||||
state: directory
|
||||
suffix: dwn
|
||||
register: tempfolder_1
|
||||
|
||||
- name: download nunbot
|
||||
loop: "{{ nunbot_latest.json[0].assets }}"
|
||||
when: "'amd64.tar.gz' in item.name"
|
||||
unarchive:
|
||||
remote_src: yes
|
||||
src: "{{ item.browser_download_url }}"
|
||||
dest: "{{ tempfolder_1.path }}"
|
||||
keep_newer: yes
|
||||
|
||||
- name: installing nunbot binary
|
||||
copy:
|
||||
remote_src: yes
|
||||
src: "{{ tempfolder_1.path }}/nunbot"
|
||||
dest: /usr/local/bin/
|
||||
mode: '0755'
|
||||
register: new_binary
|
||||
|
||||
- name: installing unit file
|
||||
copy:
|
||||
remote_src: yes
|
||||
src: "{{ tempfolder_1.path }}/init/nunbot.service"
|
||||
dest: /etc/systemd/system/nunbot.service
|
||||
register: new_unit
|
||||
|
||||
- name: reload systemd with new unit
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
when: new_unit.changed or new_binary.changed
|
||||
|
||||
- name: start service
|
||||
systemd:
|
||||
name: nunbot
|
||||
state: restarted
|
||||
when: new_binary.changed
|
14
init/nunbot.service
Normal file
14
init/nunbot.service
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=NunBot: Bringing nuns, ducks and love to Matrix
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
User=root
|
||||
ExecStart=/usr/local/bin/nunbot
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in New Issue
Block a user