1# pico services
2
3This repo hosts the following pico services:
4
5- [prose.sh](https://prose.sh)
6- [lists.sh](https://lists.sh)
7- [pastes.sh](https://pastes.sh)
8- [imgs.sh](https://imgs.sh)
9- [feeds.sh](https://feeds.sh)
10- [pgs.sh](https://pgs.sh)
11
12## comms
13
14- [website](https://pico.sh)
15- [irc #pico.sh](irc://irc.libera.chat/#pico.sh)
16- [mailing list](https://lists.sr.ht/~erock/pico.sh)
17- [ticket tracker](https://github.com/picosh/pico/issues)
18- [email](mailto:hello@pico.sh)
19
20## development
21
22- `golang` >= 1.21.0
23- `direnv` to load environment vars
24- `webp` package dependency
25 - on mac can be installed with `brew install webp`
26 - on ubuntu can be installed with `sudo apt install libwebp-dev`
27
28```bash
29cp ./.env.example .env
30```
31
32Initialize local env variables using direnv
33
34```bash
35echo dotenv > .envrc && direnv allow
36```
37
38Boot up database
39
40```bash
41docker compose up -f docker-compose.yml -f docker-compose.override.yml --profile db -d
42```
43
44Create db and migrate
45
46```bash
47make create
48make migrate
49```
50
51Build services
52
53```bash
54make build
55```
56
57All services are built inside the `./build` folder.
58
59If you want to start prose execute these binaries from the project root directory:
60
61```bash
62./build/prose-web
63# in a separate terminal
64./build/prose-ssh
65```
66
67
68## deployment
69
70We use an image based deployment, so all of our images are uploaded to
71[ghcr.io/picosh/pico](https://github.com/picosh/pico/packages)
72
73```bash
74DOCKER_TAG=latest make bp-all
75```
76
77Once images are built, docker compose is used to stand up the services:
78
79```bash
80docker compose up -d
81```
82
83This makes use of a production `.env.prod` environment file which defines
84the various listening addresses and services that will be started. For production,
85we add a `.envrc` containing the following:
86
87```bash
88export COMPOSE_FILE=docker-compose.yml:docker-compose.prod.yml
89export COMPOSE_PROFILES=services,caddy
90```
91
92And symlink `.env` to `.env.prod`:
93
94```bash
95ln -s .env.prod .env
96```
97
98This allows us to use docker-compose normally as we would in development.
99
100For any migrations, logging into the our database server, pulling the changes
101to migrations and running `make latest` is all that is needed.