Simple Imageboard
![License](https://img.shields.io/github/license/AquoDev/simple-imageboard-golang)
Everything is a post.
Flow diagram π
![Diagram](https://i.imgur.com/90MK3y8.png)
Prerequisites π
- Git
- Docker (19.03+)
- Docker Compose (1.25+)
For local or mixed deployment, you also need the following:
- PostgreSQL (12+)
- Redis (6.0+)
- Golang (1.14.4+)
Installation π§
Open a terminal and follow these steps:
# Clone repository
user@system:~$ git clone https://github.com/AquoDev/simple-imageboard-golang.git
# Change directory
user@system:~$ cd simple-imageboard-golang
# Copy .env.example and rename it to .env
user@system:simple-imageboard-golang$ cp .env.example .env
# Edit .env and change every value you need, in your editor of choice
user@system:simple-imageboard-golang$ editor .env
Deployment π
It is assumed that you're in the same directory where the repository was cloned to.
Docker
# Start containers
docker-compose up -d
# Stop containers
docker-compose stop
# Update server container without losing data
docker-compose build --no-cache
# Remove containers without losing data
docker-compose down
# Delete all saved data and remove containers
docker-compose down -v
# Remove the build image (it's not needed after a clean build)
docker image prune --filter label=stage=intermediate
Local
Redis: set password
The credentials must be shared between .env
and /etc/redis/redis.conf
.
editor .env
...
REDIS_PASSWORD=your_pass_here
... (Save)
sudo editor /etc/redis/redis.conf
...
# Uncomment requirepass
requirepass your_pass_here
... (Save)
Postgres: create user and database
The credentials must be shared between .env
and these commands.
Tables are automatically created after starting the server for the first time.
sudo -u postgres psql
> CREATE DATABASE simple_imageboard;
> CREATE USER username WITH ENCRYPTED PASSWORD 'password';
> GRANT ALL PRIVILEGES ON DATABASE simple_imageboard TO username;
> \q
Server: build and run
You can edit the listening port in .env
and put a reverse proxy in front of this server.
Dependencies are bundled with the project (vendor
directory), but if you wish to download them, use the online method.
# Method 1: Using the bundled dependencies
go build -mod=vendor ./cmd/server-simple-imageboard
# Method 2: Download them (it can take a while)
go build ./cmd/server-simple-imageboard
# Start server
./server-simple-imageboard
Mixed
# Start Redis container
docker-compose -f docker-compose.yml -f docker-compose.mixed-deployment.yml up -d redis
# Start Postgres container
docker-compose -f docker-compose.yml -f docker-compose.mixed-deployment.yml up -d database
# Start Redis and Postgres containers
docker-compose -f docker-compose.yml -f docker-compose.mixed-deployment.yml up -d redis database
License π
GNU General Public License v3.0