This commit is contained in:
zleyyij 2023-01-13 18:17:36 -07:00
parent 647223cd36
commit 493569ddd5
4 changed files with 174 additions and 7 deletions

View File

@ -11,11 +11,40 @@
"id": "36ba594a14318b0c", "id": "36ba594a14318b0c",
"type": "leaf", "type": "leaf",
"state": { "state": {
"type": "empty", "type": "markdown",
"state": {} "state": {
"file": "Homelabbity.md",
"mode": "source",
"source": false
} }
} }
] },
{
"id": "77db69b73e314736",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Nand game.md",
"mode": "source",
"source": false
}
}
},
{
"id": "20806f74fc1cc561",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "Deploying TechSupportBot.md",
"mode": "source",
"source": false
}
}
}
],
"currentTab": 2
} }
], ],
"direction": "vertical" "direction": "vertical"
@ -73,6 +102,7 @@
"state": { "state": {
"type": "backlink", "type": "backlink",
"state": { "state": {
"file": "Deploying TechSupportBot.md",
"collapseAll": false, "collapseAll": false,
"extraContext": false, "extraContext": false,
"sortOrder": "alphabetical", "sortOrder": "alphabetical",
@ -110,17 +140,17 @@
"markdown-importer:Open format converter": false "markdown-importer:Open format converter": false
} }
}, },
"active": "36ba594a14318b0c", "active": "20806f74fc1cc561",
"lastOpenFiles": [ "lastOpenFiles": [
"Deploying pihole-docker to a brand new Debian instance.md", "Nand game.md",
"Homelabbity.md", "Homelabbity.md",
"Deploying pihole-docker to a brand new Debian instance.md",
"Ohm's Law.md", "Ohm's Law.md",
"Deploying PiVPN to a debian instance.md", "Deploying PiVPN to a debian instance.md",
"Migrating PiVPN configs to another server.md", "Migrating PiVPN configs to another server.md",
"Setting up SSH keys.md", "Setting up SSH keys.md",
"Installing Arch.md", "Installing Arch.md",
"Specify Server.md", "Specify Server.md",
"Writing a completely functional shell in Rust.md", "Writing a completely functional shell in Rust.md"
"wlan0 disabled after restart or wake from hibernate.md"
] ]
} }

134
Deploying TechSupportBot.md Normal file
View File

@ -0,0 +1,134 @@
## Pre-read
- Any instructions specific for `wsl` will be marked with a bolded **WSL:**. These are not needed for a standard Linux environment, and are also generally imperfect.
- Anything that you need to replace with the appropriate value will be marked as `[value]`, where the text inside the brackets is what you need to put. EG: `ls [home_dir]` would be `ls /`
- The folder that all work is done in will be further referenced as `~/ts`, if you picked a different location, remember to replace it with the appropriate directory
- A few distinctions to be made. There are two `docker-compose.yml` and `.env` file locations. They will be clarified as *environment*, (`~/ts/`, the location where the docker file and files for each of the docker containers (the bot, mongodb, postgres, and rabbitmq) are stored, and *bot* (`~/ts/discordBot/`).
## Preparation
- In the Linux environment, install `docker` (if you do not use Docker's repository, you may also need to install `docker-compose`). See [their documentation](https://docs.docker.com/engine/install/debian/) for more details on installation
- Add your user to the docker group with `sudo usermod -aG docker [user]` or run all `docker` commands with `sudo`
- **WSL:** WSL does not have `systemd` support, so you need to manually start `dockerd`. I found it simplest to run `sudo dockerd` then open a new terminal window. This is fairly jank and it's recommended to find a better method. You can also attempt to start it and hide all output (be sure that sudo does not ask for a password prompt when doing this): `sudo dockerd & 1>/dev/null 2>/dev/null`
- **WSL:** I experienced issues storing the project on Windows-side storage, and found it worked best when storing the project on the Linux volume. (YMMV)
## Deployment
### Deploying the environment
1: Create a directory to be used as a working environment. This will be referred to as `~/ts`
```
mkdir ~/ts
```
2: Enter the environment:
```
cd ~/ts
```
3: Clone the `TechSupportBot` repository into `~/ts`:
```
git clone https://github.com/r-Techsupport/TechSupportBot
```
(If you plan to contribute changes, it's recommended to fork the repository and make changes to the fork)
4: The *environment* `docker-compose.yml` file (to be created later) assumes the bot directory is named `discordBot`, so rename it or change the config file:
```
mv TechSupportBot discordBot
```
5: Set up the *environment*`.env` file for (`~/ts`) to look like below (these options can be configured, they should be if you plan to use this as a production environment):
```
RABBITMQ_DEFAULT_USER=root
RABBITMQ_DEFAULT_PASS=root
POSTGRES_DB_USER=root
POSTGRES_DB_PASSWORD=root
POSTGRES_DB_NAME=TechSupport
MONGO_DB_USER=root
MONGO_DB_PASSWORD=root
```
[source](https://discord.com/channels/749314018837135390/1058882783713444020/1059268094045999114)
6: Put the *environment* `docker-compose.yml` into `~/ts` :
```
wget -O docker-compose.yml https://cdn.discordapp.com/attachments/1058882783713444020/1059269470822072360/docker.compose1.yml
```
(If you download the file manually, remember it **must** be named `docker-compose.yml`)
[source](https://discord.com/channels/749314018837135390/1058882783713444020/1059269471140843560)
### Deploying the bot
7: Enter the `discordBot` directory:
```
cd discordBot
```
8: Copy `config.default.yml` to `config.yml`:
```
cp config.default.yml config.yml
```
9: Populate the config options using the values from the *environment* `.env` file, and Discord.
9a: It's assumed that you already made a Discord bot and added it to a server, so from the [Discord Developer Dashboard](https://discord.com/developers), select the application you created, and get the `Token` (found under the Bot submenu).
9b: Take the token located in `9a` and fill in the `auth_token` field of `config.yml`.
9c: Populate the `ids` field as shown below with your user ID (right click profile -> `Copy ID` with developer mode enabled)
Shown below is the minimum `config.yml` needed to start the bot, the rest of the fields can be populated as you see fit.
```
main:
auth_token: "He3YtherE7HiS-isMy3xAmpLeaUtHtOkEN"
admins:
ids: ["1234576890945"]
roles: []
postgres:
user: root
password: root
name: "tsbot"
host: postgres
port: 5432
mongodb:
user: root
password: root
name: "tsbot"
host: mongodb
port: 27017
rabbitmq:
user: root
password: root
host: "rabbitmq"
vhost: "/"
port: 5672
... (continued)
```
Remember to use the correct values if you modified the *environment* `.env` file.
10: Create/remake a Docker image of the bot (this needs to be done after all changes to the bot's code):
```
make prod
```
This must be run from `discordBot`, ensure the operation completes **without any fatal errors**
### Start the bot
11: Enter the *environment* directory:
```
cd ~/ts
```
12: Start all containers:
```
docker-compose up -d
```
13: Ensure the bot is running correctly:
```
docker logs discordBot
```
(You may also get spammed by Discord PMs)
## Post deployment steps
Update your guild config:
```
.config patch
```
(by default all extensions are disabled, you may need to fill this out fully or borrow someone's)

3
Nand game.md Normal file
View File

@ -0,0 +1,3 @@
![[Summary-of-the-common-Boolean-logic-gates-with-symbols-and-truth-tables.png]]
Switching for ALU:
- (inv values you want to be 0, leave untouched for 1) -> nand -> inv -> sel (use D1 for DAT, leave D0 empty)

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB