Reformatted install instructions
This commit is contained in:
		
							
								
								
									
										66
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								README.md
									
									
									
									
									
								
							@@ -1,25 +1,43 @@
 | 
				
			|||||||
# Installation
 | 
					# Installation
 | 
				
			||||||
* Setup pgsql, create user and database, create schema (last step only if you have a dump):
 | 
					
 | 
				
			||||||
  - ```psql -U postgres```
 | 
					Open psql as user ```postgres```:
 | 
				
			||||||
    - ```CREATE ROLE nxy WITH ENCRYPTED PASSWORD 'your-password';```
 | 
					```sh
 | 
				
			||||||
    - ```ALTER ROLE nxy LOGIN;```
 | 
					psql -U postgres
 | 
				
			||||||
    - ```CREATE DATABASE nxy_prod OWNER nxy;```
 | 
					```
 | 
				
			||||||
    - ```\q```
 | 
					
 | 
				
			||||||
  - ```psql -U nxy -U nxy_prod < nxy/files/schema.sql```
 | 
					Create a user with password, allowed to login and a database:
 | 
				
			||||||
  - ```psql -U nxy -d nxy_prod < path/to/dump.sql```
 | 
					```sql
 | 
				
			||||||
* Clone repo
 | 
					CREATE ROLE nxy WITH ENCRYPTED PASSWORD 'your-password';
 | 
				
			||||||
  - ```git clone https://gitfap.de/mrhanky/nxy.git```
 | 
					ALTER ROLE nxy LOGIN;
 | 
				
			||||||
* Create virtualenv, activate it and install dependencies
 | 
					CREATE DATABASE nxy_prod OWNER nxy;
 | 
				
			||||||
  - ```python3 -m venv env```
 | 
					\q
 | 
				
			||||||
  - ```source env/bin/active```
 | 
					```
 | 
				
			||||||
  - ```pip install -r nxy/requirements.txt```
 | 
					
 | 
				
			||||||
* Copy ```nxy/files/config.json``` and ```nxy/files/config.json``` and modify them
 | 
					Apply database schema and optionally restore a dump:
 | 
				
			||||||
  - ```cp nxy/files/{.env,config.json} .```
 | 
					```sh
 | 
				
			||||||
  - ```vim .env config.json```
 | 
					psql -U nxy -U nxy_prod < nxy/files/schema.sql
 | 
				
			||||||
* Enable linger for nxy user (so the user unit starts on boot)
 | 
					psql -U nxy -U nxy_prod < path/to/dump.sql
 | 
				
			||||||
  - ```sudo loginctl enable-linger nxy```
 | 
					```
 | 
				
			||||||
* Link systemd unit, enable and run it
 | 
					
 | 
				
			||||||
  - ```mkdir -p $HOME/.config/systemd/user```
 | 
					Clone git repo, create virtual env, activate it and install dependencies:
 | 
				
			||||||
  - ```ln -fs $HOME/nxy/files/nxy-bot.service $HOME/.config/systemd/user```
 | 
					```sh
 | 
				
			||||||
  - ```systemctl --user daemon-reload```
 | 
					git clone https://gitfap.de/mrhanky/nxy.git
 | 
				
			||||||
  - ```systemctl --user enable --now nxy-bot.service```
 | 
					python3 -m venv env
 | 
				
			||||||
 | 
					source env/bin/active
 | 
				
			||||||
 | 
					pip install -U -r nxy/requirements.txt
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Copy sample configs to ```$HOME``` and edit them:
 | 
				
			||||||
 | 
					```sh
 | 
				
			||||||
 | 
					cp nxy/files/{.env,config.json} .
 | 
				
			||||||
 | 
					vim .env config.json
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Enable linger for the bot user (so it starts at boot and keeps running) and install + activate systemd unit:
 | 
				
			||||||
 | 
					```sh
 | 
				
			||||||
 | 
					sudo loginctl enable-linger nxy
 | 
				
			||||||
 | 
					mkdir -p $HOME/.config/systemd/user
 | 
				
			||||||
 | 
					ln -fs $HOME/nxy/files/nxy-bot.service $HOME/.config/systemd/user
 | 
				
			||||||
 | 
					systemctl --user daemon-reload
 | 
				
			||||||
 | 
					systemctl --user enable --now nxy-bot.service
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user