Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename discord-gated-entry to discord-bot #70

Merged
merged 7 commits into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
roles:
- competitor-services-nginx
- code-submitter
- discord-gated-entry
- discord-bot

- name: Kit services
hosts: kitsvcs
Expand Down
5 changes: 5 additions & 0 deletions roles/discord-bot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SR Discord Bot

A Bot for gating entry to a Discord server.

This is a deployment of <https://github.com/srobo/discord-bot>.
4 changes: 4 additions & 0 deletions roles/discord-bot/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: Restart discord-bot
service:
name: discord-bot
state: restarted
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

- name: Download
git:
repo: https://github.com/srobo/discord-gated-entry
repo: https://github.com/srobo/discord-bot
dest: "{{ install_dir }}"
force: true
version: 476a9c942f580e2950048c2b95e15429cb0ae33d
version: b12c95980701d6c090f7b0da16499475011b0026
notify:
Restart discord-gated-entry
register: discord_gated_entry_repo
Restart discord-bot
register: discord_bot_repo
become_user: discord

- name: Bootstrap environment file
Expand All @@ -37,27 +37,27 @@
mode: "0600"
owner: discord
notify:
Restart discord-gated-entry
Restart discord-bot

- name: Install virtual environment
pip:
virtualenv: "{{ venv_dir }}"
requirements: "{{ install_dir }}/requirements.txt"
name: file://{{ install_dir }}
notify:
Restart discord-gated-entry
Restart discord-bot
become_user: discord
when: discord_gated_entry_repo.changed # noqa: no-handler - Use a handler to ensure execution order
when: discord_bot_repo.changed # noqa: no-handler - Use a handler to ensure execution order

- name: Install systemd service
template:
src: discord-gated-entry.service
dest: /etc/systemd/system/discord-gated-entry.service
src: discord-bot.service
dest: /etc/systemd/system/discord-bot.service
mode: "0644"
notify:
Restart discord-gated-entry
Restart discord-bot

- name: Enable service
service:
name: discord-gated-entry
name: discord-bot
state: started
enabled: true
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=Discord bot for gated entry
Description=Discord bot
After=network.target

[Service]
Expand All @@ -8,9 +8,9 @@ User=discord
Type=simple

WorkingDirectory={{ install_dir }}
RuntimeDirectory=discord-gated-entry
RuntimeDirectory=discord-bot

ExecStart=/srv/discord-gated-entry/venv/bin/python main.py
ExecStart={{ venv_dir }}/bin/python -m sr.discord_bot

[Install]
WantedBy=multi-user.target
2 changes: 2 additions & 0 deletions roles/discord-bot/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
install_dir: /srv/discord-bot
venv_dir: "{{ install_dir }}/venv"
5 changes: 0 additions & 5 deletions roles/discord-gated-entry/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions roles/discord-gated-entry/handlers/main.yml

This file was deleted.

2 changes: 0 additions & 2 deletions roles/discord-gated-entry/vars/main.yml

This file was deleted.

Loading