repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

Eric Bower · 16 Jul 24

dev.md

 1## development
 2
 3- `golang` >= 1.22.0
 4- `direnv` to load environment vars
 5
 6```bash
 7cp ./.env.example .env
 8```
 9
10Initialize local env variables using direnv
11
12```bash
13echo dotenv > .envrc && direnv allow
14```
15
16Boot up database (or bring your own)
17
18```bash
19docker compose up -f docker-compose.yml -f docker-compose.override.yml --profile db -d
20```
21
22Create db and migrate
23
24```bash
25make create
26make migrate
27```
28
29```bash
30go run ./cmd/pgs/ssh
31# in a separate terminal
32go run ./cmd/pgs/web
33```
34
35## deployment
36
37We use an image based deployment, so all of our images are uploaded to
38[ghcr.io/picosh/pico](https://github.com/picosh/pico/packages)
39
40```bash
41DOCKER_TAG=latest make bp-all
42```
43
44Once images are built, docker compose is used to stand up the services:
45
46```bash
47docker compose up -d
48```
49
50This makes use of a production `.env.prod` environment file which defines the
51various listening addresses and services that will be started. For production,
52we add a `.envrc` containing the following:
53
54```bash
55export COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml
56export COMPOSE_PROFILES=services,caddy
57```
58
59And symlink `.env` to `.env.prod`:
60
61```bash
62ln -s .env.prod .env
63```
64
65This allows us to use docker-compose normally as we would in development.
66
67For any migrations, logging into the our database server, pulling the changes to
68migrations and running `make latest` is all that is needed.