bglug.it/README.md
Paolo Asperti 8f8e3c07ec
Some checks failed
Container Build / build-image (push) Successful in 44s
Container Publish / build-image (push) Failing after 33s
Vulnerability Scan / Daily Vulnerability Scan (push) Failing after 6s
dev notes
2024-04-16 23:33:34 +02:00

109 lines
2.2 KiB
Markdown

# bglug.it
BgLUG website
## Development instructions
Clone repo with the command:
```sh
git clone --recurse-submodules ssh://git@git.libreschool.org:1022/bglug/bglug.it.git
cd bglug.it
```
If you did clone this repo in the usual way, you probably missed the theme's git submodule. To download the missing submodule:
```sh
cd bglug.it
git submodule update --init --recursive
```
Then start the hugo live server:
```sh
hugo server
```
or
```sh
docker run --rm -d --name hugo_ls -v "$PWD:/src" -p "1313:1313" git.libreschool.org/bglug/hugo-extended:latest serve -s /src --gc --minify --bind 0.0.0.0
```
You can produce the complete website with:
```sh
hugo
```
The complete website will be placed in the `public` directory.
### Development misc notes
The imported posts are marked as "draft" and as such aren't rendered in the final output. If you want to render all the drafts, you can add the `-D` flag:
```sh
hugo server -D
```
## Building the container image
This website can be used as a container image; to do so in docker:
```sh
docker build -t bglug-website .
```
Then you can run the image:
```sh
docker run -d -p 6080:80 bglug-website
```
With the above command, the website will be reachable via HTTP to port 6080.
It's also possible do bind mount the container's `/logs` directory, to expose nginx logs.
## Using the container image
### Plain docker invocation
```sh
docker run -d --name bglug_website -p 6080:80 git.libreschool.org/bglug/bglug.it:latest
```
### Via docker compose
```yaml
version: "3.9"
services:
web:
image: git.libreschool.org/libreschool/bglug.it:latest
restart: always
container_name: bglug_website
volumes:
- ./logs:/logs
ports:
- 6080:80
```
## Configure log rotation
By default logs are stored in a volume mounted on `/logs` directory inside the container.
The access log file is `/logs/nginx.access.log` and it is rotate daily with a configurable retention, `7 days` by default.
```yaml
version: "3.9"
services:
web:
image: git.libreschool.org/bglug/bglug.it:latest
restart: always
container_name: bglug_website
volumes:
- ./logs:/logs
environment:
LOG_DAYS: 14
ports:
- 6080:80
```