a mini social media app for small communities

dockerification

+18
.dockerignore
··· 1 + # Binaries 2 + /beep 3 + /build/ 4 + 5 + # Editor/system specific metadata 6 + .DS_Store 7 + .vscode/ 8 + 9 + # Secrets 10 + /config.real.maple 11 + .env 12 + 13 + # Local V and Clockwork install (Gitpod) 14 + /clockwork 15 + /v/ 16 + 17 + # Quick notes I keep while developing 18 + /stickynote.md
-1
.gitignore
··· 13 13 # Local V and Clockwork install (Gitpod) 14 14 /clockwork 15 15 /v/ 16 - /clockwork/ 17 16 18 17 # Quick notes I keep while developing 19 18 /stickynote.md
+43
Dockerfile
··· 1 + FROM debian:trixie-slim 2 + 3 + # Create beep group and user 4 + RUN <<EOF 5 + set -eux 6 + groupadd -r beep 7 + useradd -r -g beep beep -d /beep -s /bin/sh 8 + install -vd -o beep -g beep -m 1777 /beep 9 + EOF 10 + 11 + # Install base packages. These might already be installed by the image. 12 + RUN <<EOF 13 + set -eux 14 + apt update 15 + apt install -y --no-install-recommends \ 16 + ca-certificates build-essential git libpq-dev 17 + EOF 18 + 19 + # Install V 20 + RUN <<EOF 21 + set -eux 22 + git clone --depth=1 https://github.com/vlang/v /opt/v 23 + cd /opt/v 24 + make 25 + ln -s /opt/v/v /usr/local/bin/v 26 + EOF 27 + 28 + USER beep 29 + WORKDIR /beep 30 + COPY . . 31 + 32 + # Install beep 33 + RUN <<EOF 34 + set -eux 35 + # git clone --depth=1 https://tangled.org/emmeline.girlkisser.top/beep . 36 + mkdir -p ~/.vmodules/emmathemartian/maple 37 + git clone --depth=1 https://github.com/emmathemartian/maple ~/.vmodules/emmathemartian/maple 38 + v -prod . 39 + EOF 40 + 41 + STOPSIGNAL SIGINT 42 + EXPOSE 8008 43 + CMD ["./beep", "./config.real.maple"]
+26 -5
compose.yml
··· 1 - version: "3" 2 1 volumes: 3 2 beep-data: 4 - beep-data-export: 3 + 4 + # networks: 5 + # common: {} 6 + 5 7 services: 6 8 beep-database: 7 - image: docker.io/postgres:15-alpine 9 + image: postgres:17 8 10 container_name: beep-database 11 + # ports: 12 + # - 127.0.0.1:5432:5432 9 13 ports: 10 14 - 5432:5432 11 15 environment: 12 16 - POSTGRES_DB=beep 13 17 - POSTGRES_USER=beep 14 - - POSTGRES_PASSWORD=beep 18 + - POSTGRES_PASSWORD=beep # CHANGE THIS 15 19 volumes: 16 20 - beep-data:/var/lib/postgresql/data 17 - - beep-data-export:/export 21 + restart: on-failure:3 22 + # networks: 23 + # - common 24 + 25 + beep: 26 + build: . 27 + container_name: beep 28 + depends_on: 29 + - beep-database 30 + ports: 31 + - 8008:8008 32 + volumes: 33 + - type: bind 34 + source: ${PWD}/config.real.maple 35 + target: /beep/config.real.maple 36 + restart: on-failure:3 37 + # networks: 38 + # - common
+2 -1
config.maple
··· 27 27 } 28 28 29 29 postgres = { 30 - host = 'localhost' 30 + // name of database container in compose.yml 31 + host = 'beep-database' 31 32 port = 5432 32 33 user = 'beep' 33 34 password = 'beep'
+18 -23
readme
··· 13 13 hosting 14 14 ------- 15 15 16 - You'll need a PostgreSQL database somewhere, along with V 17 - to compile beep: 18 - 19 - $ git clone https://github.com/emmathemartian/beep 16 + $ git clone https://tangled.org/emmeline.girlkisser.top/beep 20 17 $ cd beep 21 - $ v -prod . 22 - 23 - Copy the `config.maple` as `config.real.maple` 24 - 25 18 $ cp config.maple config.real.maple 26 19 27 - Edit `config.real.maple` to set the URL, port, DB username, 28 - password, and name. 20 + Edit config.real.maple to set ports, auth, etc. 29 21 30 22 `config.real.maple` also has settings to configure the 31 23 default theme, post length, username length, welcome 32 24 messages, etc etc. 33 25 34 - WARNING: DO NOT PUT SECRETS IN `config.maple`. 35 - `config.maple` is intended to be pushed to Git as a 36 - "template config." Instead, use `config.real.maple` if you 37 - plan to push anywhere. It's gitignored by default, i.e, an 38 - accidental exclusion in the gitignore and push won't expose 39 - your keys. 26 + [WARNING] DO NOT PUT SECRETS IN config.maple 27 + config.maple is intended to be pushed to Git as a template 28 + config for your instance. Instead, put your secrets in 29 + config.real.maple, which is gitignored. 30 + TODO: Read secrets from .env automatically. 40 31 41 - $ ./beep config.real.maple 32 + With Docker: 33 + $ docker compose up 42 34 43 - Then go to the configured port to view (default is 44 - `http://localhost:8008`). 35 + Without Docker: 36 + (assumes you already have a database somewhere) 37 + $ v install EmmaTheMartian.Maple 38 + $ v -prod . 39 + $ ./beep config.real.maple 45 40 46 - If you don't have a database, you can either self-host a 47 - psql database on your machine, or you can find a free one 48 - online. I like [neon.tech](https://neon.tech), their free 49 - plan is pretty comfortable for a small beep instance! 41 + If `v install ...` fails then you can install Maple 42 + manually: 43 + $ mkdir -p ~/.vmodules/emmathemartian/maple 44 + $ git clone https://github.com/emmathemartian/maple ~/.vmodules/emmathemartian/maple