Skip to content

Commit 8384a74

Browse files
feat(docs): added section on postgres to self-host docs
1 parent 00c3b1b commit 8384a74

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

docs/self-hosting.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,54 @@
4444
> If this gets stuck your database URL is most likely incorrect. Please check the URL (port as well, port is usually 5432). You should give the command 30 seconds to run before you assume it's stuck.
4545
4646
7. Run `(prefix)help` in your server to see if the bot is running. If it is, now you can start configuring the bot.
47+
48+
## Setting Up a Local PostgreSQL Database
49+
50+
If you prefer running PostgreSQL locally instead of using Supabase, follow these steps:
51+
52+
1. **Install PostgreSQL**
53+
54+
On Debian, run:
55+
56+
```bash
57+
sudo apt update
58+
sudo apt install postgresql postgresql-contrib
59+
```
60+
61+
2. **Start and enable the PostgreSQL service**
62+
63+
```bash
64+
sudo systemctl start postgresql
65+
sudo systemctl enable postgresql
66+
```
67+
68+
3. **Create a database user and database**
69+
70+
Switch to the `postgres` user and enter the PostgreSQL shell:
71+
72+
```bash
73+
sudo -i -u postgres
74+
psql
75+
```
76+
77+
Inside psql, run:
78+
79+
```sql
80+
CREATE USER tuxuser WITH PASSWORD 'yourpassword';
81+
CREATE DATABASE tuxdb OWNER tuxuser;
82+
\q
83+
```
84+
85+
Exit back:
86+
87+
```bash
88+
exit
89+
```
90+
91+
4. **Use this connection URL in `.env`**
92+
93+
```
94+
postgres://tuxuser:yourpassword@localhost:5432/tuxdb
95+
```
96+
97+
Your local PostgreSQL is now ready for Tux. Remember to replace `yourpassword` with a secure password of your choice!

0 commit comments

Comments
 (0)