Skip to content

Commit

Permalink
update production documentation to reflect recent changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ehanahamed committed Jan 27, 2025
1 parent d8168ef commit ed3f5e7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/dev/production/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Right now, Quizfreely's website and api run on the same server/droplet.

Important thingies:
- `/root/quizfreely/api/`
- `/home/quizfreely/quizfreely/api/`
- `.env`
- `/root/quizfreely/web/`
- `home/quizfreely/quizfreely/web/`
- `build/`
- `.env`
- `/etc/caddy/Caddyfile`
Expand Down
7 changes: 4 additions & 3 deletions docs/dev/production/api-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Production setup for api

You should probably create a user first, for our production server we made an unprivileged user, `quizfreely`, to run the server processes, with a home dir/folder at `/home/quizfreely/`: (our systemd service/unit which we configure later will use this user)
You should probably create a user first. For our production server we made an unprivileged user, `quizfreely`, to run the server processes, with a home dir/folder at `/home/quizfreely/`: (our systemd service/unit which we configure later will use this user)
```bash
sudo useradd -m -s /bin/bash quizfreely
```
Expand Down Expand Up @@ -32,14 +32,14 @@ npm install

Install PostgreSQL from your/our package manager
```sh
exit # back to a different user that can use sudo, we shouldn't let the user that runs our server process have sudo
sudo apt install postgresql
# or
# sudo pacman -S postgresql
```

Check if `postgresql.service` is running
```sh
exit
sudo systemctl status postgresql.service
# if it's not running, run:
# sudo systemctl start postgresql.service
Expand All @@ -57,7 +57,6 @@ sudo systemctl status postgresql.service

Then switch to the `postgres` linux user (do it again, if you already did)
```sh
exit
sudo su postgres
cd ~
```
Expand Down Expand Up @@ -206,6 +205,7 @@ sudo systemctl status quizfreely-api

Pull changes with git:
```sh
sudo su quizfreely
cd ~/quizfreely/api
git pull
# if there are changes to .env.example
Expand All @@ -225,6 +225,7 @@ Also make sure to keep `public.search_queries` and `quizfreely/config/db/search-

After all changes are made, start quizfreely-api again:
```sh
exit # back to user with sudo permissions
sudo systemctl start quizfreely-api
# if there were any changes to caddy,
# check developer docs > production > caddy-setup.md
Expand Down
7 changes: 4 additions & 3 deletions docs/dev/production/web-setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Production setup for web

You should probably create a user first, for our production server we made an unprivileged user, `quizfreely`, to run the server processes, with a home dir/folder at `/home/quizfreely/`: (our systemd service/unit which we configure later will use this user)
You should probably create a user first. For our production server we made an unprivileged user, `quizfreely`, to run the server processes, with a home dir/folder at `/home/quizfreely/`: (our systemd service/unit which we configure later will use this user)
```bash
sudo useradd -m -s /bin/bash quizfreely
```
Expand All @@ -24,7 +24,6 @@ For more nodejs installation info, see [install-nodejs.md](./install-nodejs.md)

Install node modules
```sh
sudo su quizfreely
cd ~/quizfreely/web/
npm install
```
Expand Down Expand Up @@ -70,7 +69,8 @@ For more details about the .env file, see [web-dotenv.md](../web/web-dotenv.md)

Copy the systemd service file into its correct location (usually `/etc/systemd/system/`)
```sh
cd ~/quizfreely/
exit # back to user with sudo permissions
cd /home/quizfreely/quizfreely/
sudo cp config/quizfreely-web.service /etc/systemd/system/
```

Expand Down Expand Up @@ -119,6 +119,7 @@ git pull

After all changes are made, start quizfreely-web again:
```sh
exit # back to user with sudo permissions
sudo systemctl start quizfreely-web
# if there were any changes to caddy,
# check developer docs > production > caddy-setup.md
Expand Down

0 comments on commit ed3f5e7

Please sign in to comment.