simple-imageboard-golang

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 28, 2021 License: GPL-3.0

README ΒΆ

Simple Imageboard

GoDev reference Go report card Latest release License

Diagram Everything is a post.

Flow diagram πŸ”„

Diagram

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

Directories ΒΆ

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL