2019-06-12 15:02:15 +02:00
# nooo-hbsc
2019-09-17 19:59:14 +02:00
The new homebrewserver.club website :)
2019-06-17 11:48:59 +02:00
> https://homebrewserver.club/
2019-06-12 15:02:15 +02:00
## Build the site locally
2019-07-01 12:39:12 +02:00
### Get a local copy
```bash
$ git clone --recurse-submodules https://git.vvvvvvaria.org/varia/nooo-hbsc
```
2019-06-17 11:48:59 +02:00
### System requirements
2019-06-12 15:02:15 +02:00
2019-06-17 11:48:59 +02:00
Install the system requirements:
2019-06-12 15:02:15 +02:00
```bash
2019-06-17 11:48:59 +02:00
$ apt install -y python3 python3-dev python3-venv
2019-06-12 15:02:15 +02:00
```
2019-06-17 11:48:59 +02:00
### Python requirements
2019-06-12 15:02:15 +02:00
2019-06-17 11:48:59 +02:00
Then create a virtual environment and activate it:
2019-06-12 15:02:15 +02:00
```bash
$ python3 -m venv .venv
$ source .venv/bin/activate
```
Then install the requirements:
```bash
2019-06-17 11:48:59 +02:00
$ pip install -r requirements.txt
2019-06-12 15:02:15 +02:00
```
2019-06-12 15:13:20 +02:00
2019-06-12 15:19:05 +02:00
### Generating the site
2019-06-17 11:48:59 +02:00
Generate the content and run the server:
2019-06-12 15:13:20 +02:00
```bash
$ pelican content
2019-06-19 14:38:36 +02:00
$ pelican --listen --relative-urls
2019-06-12 15:13:20 +02:00
```
2019-06-12 15:19:05 +02:00
Then the site is available at the following URL:
> http://localhost:8000
2019-06-17 11:48:59 +02:00
## Working with the site
2019-06-12 15:19:05 +02:00
2019-06-17 11:54:25 +02:00
* Website articles and content are in [content ](./content )
2019-06-17 11:56:16 +02:00
* The website theme is in [themes/homebrewtheme ](./themes/homebrewtheme )
2019-06-19 12:36:44 +02:00
* Images are stored in [content/images ](./content/images )
2019-06-19 12:37:57 +02:00
* Configs are stored in [content/downloads ](./content/downloads )
2019-06-17 11:48:59 +02:00
While working on the site, you can run the following:
2019-06-12 15:19:05 +02:00
2019-06-17 11:56:16 +02:00
```bash
2019-06-19 14:38:36 +02:00
$ pelican --autoreload --listen --relative-urls
2019-06-17 11:56:16 +02:00
```
2019-06-17 12:20:20 +02:00
### Writing drafts
Use `Status: draft` in the article metadata. When the site is generated, the
`output/drafts` folder will be created with your new draft article. This allows
us to work on new articles and still store the pages here in the repository.
2019-06-17 11:48:59 +02:00
## Deploying the site
2019-09-17 19:44:08 +02:00
We have a Git hook setup, so just push as you would as normal:
```
$ git push origin master
```
2019-09-17 20:05:37 +02:00
Details for maintaining the hook on the Varia server are:
* We have cloned the site in `/srv/gitea/clones/homebrewserver.club`
* We have create a hook deployment script in `/srv/gitea/gitea-repositories/varia/homebrewserver.club.git/hooks/post-update`
How it works: when someone runs a `git push origin master` , the script in the `post-update` will run after the updating is finished. In this script, we run all the steps to publish the site as per usual. Such as running `pip install -r requirements.txt` and `pelican` to generate the new output.