🔨 chore: clean up docker compose file, mention it in the readme
All checks were successful
ci/woodpecker/push/clippy Pipeline was successful

This commit is contained in:
fawn 2023-11-24 10:14:12 +02:00
parent d028e753ec
commit 5985c2b21e
Signed by: fawn
GPG key ID: 1F1D882E2C3A12D1
6 changed files with 56 additions and 26 deletions

View file

@ -6,5 +6,5 @@ WEBHOOK_URL = "" # (optional) the discord webhook url. this will be used to send
TAMAKO_SECRET = "" # the secret key used for authentication. think of it like a master password.
# TAMAKO_USER_NAME = "ruby" # (optional) defaults to "tamako". used in the fronted header.
# TAMAKO_USER_DESCRIPTION = "i love msuic 🤍" # (optional) defaults to "Cozy anonymous whispers 🐞". used in the fronted header.
# TAMAKO_USER_NAME = "sofia" # (optional) defaults to "tamako". used in the web fronted header.
# TAMAKO_USER_DESCRIPTION = "stupidest kibty" # (optional) defaults to "Cozy anonymous whispers 🐞". used in the web fronted header.

View file

@ -1,18 +1,15 @@
FROM rust:1.71 AS builder
FROM rust:1.74 AS builder
WORKDIR /usr/src/tamako
COPY . .
RUN cargo install cargo-binstall
# hadolint ignore=DL3059
RUN cargo binstall -y sqlx-cli
# RUN --mount=type=cache,target=/usr/local/cargo,from=builder,source=/usr/local/cargo \
# --mount=type=cache,target=target \
# cargo build --release && mv ./target/release/tamako ./tamako
RUN cargo install sqlx-cli --no-default-features --features native-tls,postgres
RUN cargo build --release && mv ./target/release/tamako ./tamako
FROM debian:bullseye-slim
FROM debian:bookworm-slim
# hadolint ignore=DL3008
RUN apt-get update && apt-get install -y --no-install-recommends libssl-dev pkg-config ca-certificates && apt-get clean && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /usr/src/tamako/tamako /usr/src/tamako/migrations/ /usr/src/tamako/assets/ /app/
COPY --from=builder /usr/src/tamako/tamako /app/
COPY --from=builder /usr/src/tamako/migrations/ /app/migrations/
COPY --from=builder /usr/src/tamako/assets/ /app/assets/
COPY --from=builder /usr/local/cargo/bin/sqlx /usr/local/bin/sqlx
CMD [ "/app/tamako" ]

View file

@ -25,13 +25,32 @@ tamako is a cozy, minimalistic, single-user, _anonymous_ whispers service
| `TAMAKO_USER_NAME` | String | tamako | _(optional)_ used in the fronted header |
| `TAMAKO_USER_DESCRIPTION` | String | Cozy anonymous whispers 🐞 | _(optional)_ used in the fronted header |
## Usage
## Installation
### Docker Compose (recommended)
Docker compose will also create a postgres service container.
1. Clone the repo
2. Rename `pg.env.example` to `pg.env` and change the user and password
3. Rename `docker.env.example` to `docker.env` and change env variables inside it
4. `docker compose up -d`
### Locally
1. Clone the repo
2. Rename `.env.example` to `.env` and change env variables inside it
3. Build tamako: `cargo build --release`
4. Run tamako: `./target/release/tamako`
### Docker
Using docker directly is possible, but you have to configure the container yourself.
```sh
docker run -d --name tamako --restart unless-stopped -p 8715:8715 ghcr.io/fawni/tamako:latest
```
## TUI
tamako comes with a pretty little tui frontend for it called mochi

View file

@ -1,30 +1,31 @@
version: "3.9"
services:
api:
image: fawn/tamako
build: .
restart: unless-stopped
env_file:
- docker.env
ports:
- "8718:8715"
depends_on:
- db
networks:
- tamako
db:
image: postgres
restart: unless-stopped
env_file:
- pg.env
ports:
- "54328:5432"
- "5432"
volumes:
- tamakodb:/var/lib/postgresql/data
networks:
- tamako
web:
image: ghcr.io/fawni/tamako
# build the image locally instead of pulling - dev
# build: .
restart: unless-stopped
env_file:
- docker.env
ports:
- "8715:8715"
depends_on:
- db
networks:
- tamako
volumes:
tamakodb:

10
docker.env.example Normal file
View file

@ -0,0 +1,10 @@
TAMAKO_HOST = "127.0.0.1" # the host to run the server on.
TAMAKO_PORT = "8715" # the port to run the server on. make sure it's not already in use.
DATABASE_URL = "postgresql://user:password@db:5432/tamako" # the database url. for docker compose, change `user` and `password` to the variables set in `pg.env`.
WEBHOOK_URL = "" # (optional) the discord webhook url. this will be used to send whispers (private and public) to a discord channel.
TAMAKO_SECRET = "" # the secret key used for authentication. think of it like a master password.
# TAMAKO_USER_NAME = "sofia" # (optional) defaults to "tamako". used in the web fronted header.
# TAMAKO_USER_DESCRIPTION = "stupidest kibty" # (optional) defaults to "Cozy anonymous whispers 🐞". used in the web fronted header.

3
pg.env.example Normal file
View file

@ -0,0 +1,3 @@
POSTGRES_USER="user"
POSTGRES_PASSWORD="password"
POSTGRES_DB="tamako"