![]() |
2 months ago | |
---|---|---|
app | 2 months ago | |
config | 8 months ago | |
logger | 1 year ago | |
mock | 1 year ago | |
scripts/dev | 1 year ago | |
static | 4 months ago | |
template | 4 months ago | |
translation | 1 year ago | |
us83kunc | 6 months ago | |
.dockerignore | 4 months ago | |
.drone.yml | 1 year ago | |
.gitignore | 4 months ago | |
Dockerfile | 4 months ago | |
Dockerfile.dev | 1 year ago | |
LICENSE | 2 years ago | |
Makefile | 1 year ago | |
README.md | 4 months ago | |
docker-compose.yml | 4 months ago | |
go.mod | 8 months ago | |
go.sum | 8 months ago | |
logo.png | 5 months ago | |
main.go | 12 months ago | |
nginx.vhost.conf | 4 months ago |
README.md
83kun
The last atempt of a 83channel engine.
Overview
That project aims to build a modular imageboard engine using Go and Clean Arquitecture.
Installation
Env variables
MONGO_URI
mongodb connection stringFILE_DIR
path to file storage directoryLOG_FILE
path to a log file, leave empty to output logs to stdoutTHUMB_DIR
path to thumb storage directoryDEFAULT_AUDIO_COVER
path to a image file used as the default audio file cover imageMONGO_DATABASE_NAME
name of the mongodb databaseWEB_NOTIFICATION_EMAIL
email used in webpush notificationsWEB_NOTIFICATION_VAPID_PUBLIC_KEY
public key used in webpush notificationsWEB_NOTIFICATION_VAPID_PRIVATE_KEY
private key used in webpush notificationsPLUGINS_DIR
path to a directory of plugins loaded by the engine
Manual
Requirements
- ImageMagick 7
- FFmpeg 6
- Go 1.18
- Make
- MongoDB 5
Build
Build the 83kun
executable with:
make build
Now you can run the 83kun command. Make sure you have a mongodb database running locally and start the application server with:
export MONGO_URI='mongodb://localhost:27017/'
export FILE_DIR=/data/files
export THUMB_DIR=/data/thumb
./83kun server --host 0.0.0.0 --port 7777
Now you need to configure a reverse proxy, nginx, to serve the engine correctly. You may use the nginx.vhost.conf
file provided as a base template.
Docker Compose (Recommended)
Create a local 83kun-files and 83kun-thumb folder:
mkdir 83kun-files
mkdir 83kun-thumb
Open the Dockerfile
, go at line 25
, 26
, 27
and 31
and change the 1001 guid or 1000 uid to your local guid and uid (use the id
command to get those values).
Now you can run the engine with:
docker-compose up
When the engine is up and running, you can create a initial tag with docker exec:
docker exec -it 83kun-83kun-1 ./83kun tag create h
docker exec -it 83kun-83kun-1 ./83kun tag update --global h
And other yo your liking:
docker exec -it 83kun-83kun-1 ./83kun tag create nsfw
docker exec -it 83kun-83kun-1 ./83kun tag create pol
docker exec -it 83kun-83kun-1 ./83kun tag create 2d
# To know more about the ./83kun command run
docker exec -it 83kun-83kun-1 ./83kun --help
Docker
Build the image.
docker build -t 83kun:last .
Now you can run the engine with docker run command. Make sure you have a mongodb database running locally.
docker run -it --rm --name 83kun \
--add-host=localhost:host-gateway \
-e DEFAULT_AUDIO_COVER=/data/files/audio.png \
-e LOG_FILE= \
-e FILE_DIR=/data/files \
-e THUMB_DIR=/data/thumb \
-e MONGO_URI='mongodb://localhost:27017/' \
-p 7777:7777 \
-p 7778:7778 \
-p 7780:7780 \
-v ./83kun-files:/data/files \
-v ./83kun-thumb:/data/thumb \
--entrypoint /app/83kun \
83kun:last \
serve --host 0.0.0.0 --port 7777
Development
Folder structure
.
├── translation/ # i18n translation files
├── us83kunc/ # go library used by plugins to stabilish a communication channel
├── config/ # global configuration
├── logger/ # global logging library
└── app/ # engine code, clean arquitecture style
├── adapter/ # communication with outside world goes here
├── contract/ # interfaces used by the engine to talk to external libraries
├── controller/ # controllers used to bridge the i/o between the adapter layer and the usecase layer
├── entity/ # core entities of the engine, essential operations and business logic
├── factory/ # object instantiation goes here
├── infrastructure/ # external libraries and databases
├── presenter/ # interfaces used by the controllers to format the output of a usecase
├── repository/ # interfaces for all database operations
├── usecase/ # all business logic operations
└── view/ # views used by the controllers to output a specific response for a specific adapter, must implement a presenter interface
Watch command
You can automatically reload the engine when editing the code with the command:
make watch
But you need to have entr
installed.