This commit is contained in:
parent
ec3206331b
commit
8210345ca4
9 changed files with 103 additions and 8 deletions
|
@ -10,6 +10,8 @@ test
|
|||
benchmarks
|
||||
docs/site
|
||||
docker-db
|
||||
uploads
|
||||
instance
|
||||
|
||||
# Required to get version
|
||||
!.git
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -21,6 +21,8 @@ vm.args
|
|||
.hex/
|
||||
.mix/
|
||||
.psql_history
|
||||
docker-resources/Dockerfile
|
||||
pgdata
|
||||
|
||||
# Prevent committing custom emojis
|
||||
/priv/static/emoji/custom/*
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
FROM hexpm/elixir:1.13.4-erlang-24.3.4.5-alpine-3.15.6 as build
|
||||
|
||||
FROM hexpm/elixir:1.13.4-erlang-24.3.4.5-alpine-3.15.6
|
||||
|
||||
ENV MIX_ENV=prod
|
||||
|
||||
|
|
|
@ -2,7 +2,8 @@ version: "3.7"
|
|||
|
||||
services:
|
||||
db:
|
||||
image: postgres:14
|
||||
image: akkoma-db:latest
|
||||
build: ./docker-resources/database
|
||||
restart: unless-stopped
|
||||
user: ${DOCKER_USER}
|
||||
environment: {
|
||||
|
@ -19,7 +20,9 @@ services:
|
|||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./docker-db:/var/lib/postgresql/data
|
||||
- type: bind
|
||||
source: ./pgdata
|
||||
target: /var/lib/postgresql/data
|
||||
|
||||
akkoma:
|
||||
image: akkoma:latest
|
||||
|
@ -41,3 +44,16 @@ services:
|
|||
]
|
||||
volumes:
|
||||
- .:/opt/akkoma
|
||||
|
||||
# Uncomment the following if you want to use a reverse proxy
|
||||
proxy:
|
||||
image: caddy:2-alpine
|
||||
restart: unless-stopped
|
||||
links:
|
||||
- akkoma
|
||||
ports: [
|
||||
"443:443",
|
||||
"80:80"
|
||||
]
|
||||
volumes:
|
||||
- ./docker-resources/Caddyfile:/etc/caddy/Caddyfile
|
14
docker-resources/Caddyfile
Normal file
14
docker-resources/Caddyfile
Normal file
|
@ -0,0 +1,14 @@
|
|||
# default docker Caddyfile config for Akkoma
|
||||
#
|
||||
# Simple installation instructions:
|
||||
# 1. Replace 'example.tld' with your instance's domain wherever it appears.
|
||||
|
||||
akkoma.local.live {
|
||||
log {
|
||||
output file /var/log/caddy/akkoma.log
|
||||
}
|
||||
|
||||
encode gzip
|
||||
|
||||
reverse_proxy akkoma:4000
|
||||
}
|
14
docker-resources/Caddyfile.example
Normal file
14
docker-resources/Caddyfile.example
Normal file
|
@ -0,0 +1,14 @@
|
|||
# default docker Caddyfile config for Akkoma
|
||||
#
|
||||
# Simple installation instructions:
|
||||
# 1. Replace 'example.tld' with your instance's domain wherever it appears.
|
||||
|
||||
example.tld {
|
||||
log {
|
||||
output file /var/log/caddy/akkoma.log
|
||||
}
|
||||
|
||||
encode gzip
|
||||
|
||||
reverse_proxy akkoma:4000
|
||||
}
|
10
docker-resources/database/Dockerfile
Normal file
10
docker-resources/database/Dockerfile
Normal file
|
@ -0,0 +1,10 @@
|
|||
FROM postgres:14-alpine
|
||||
|
||||
ARG UID=1000
|
||||
ARG GID=1000
|
||||
ARG UNAME=akkoma
|
||||
|
||||
RUN addgroup -g $GID $UNAME
|
||||
RUN adduser -u $UID -G $UNAME -D -h $HOME $UNAME
|
||||
|
||||
USER akkoma
|
3
docker-resources/manage.sh
Executable file
3
docker-resources/manage.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
|
||||
docker-compose run --rm akkoma $@
|
|
@ -49,7 +49,9 @@ in our compose environment.
|
|||
```
|
||||
|
||||
This will ask you a few questions - the defaults are fine for most things,
|
||||
the database hostname is `db`.
|
||||
the database hostname is `db`, and you will want to set the ip to `0.0.0.0`
|
||||
if you want to access the instance from outside the container (i.e you're using
|
||||
a reverse proxy on the host)
|
||||
|
||||
Now we'll want to copy over the config it just created
|
||||
|
||||
|
@ -62,7 +64,7 @@ cp config/generated_config.exs config/prod.secret.exs
|
|||
We need to run a few commands on the database container, this isn't too bad
|
||||
|
||||
```bash
|
||||
docker-compose run --rm -d db
|
||||
docker-compose run --rm --user akkoma -d db
|
||||
# Note down the name it gives here, it will be something like akkoma_db_run
|
||||
docker-compose run --rm akkoma psql -h db -U akkoma -f config/setup_db.psql
|
||||
docker stop akkoma_db_run # Replace with the name you noted down
|
||||
|
@ -83,14 +85,47 @@ everything start up.
|
|||
```bash
|
||||
docker-compose up
|
||||
```
|
||||
#### Create your first user
|
||||
|
||||
If everything went well, you should be able to access your instance at http://localhost:4000
|
||||
|
||||
You can `ctrl-c` out of the docker-compose now to shutdown the server.
|
||||
|
||||
### Running in the background
|
||||
|
||||
```bash
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### Create your first user
|
||||
|
||||
If your instance is up and running, you can create your first user with administrative rights with the following task:
|
||||
|
||||
```shell
|
||||
doas -u akkoma env MIX_ENV=prod mix pleroma.user new <username> <your@emailaddress> --admin
|
||||
./docker-resources/manage.sh mix pleroma.user new MY_USERNAME MY_EMAIL@SOMEWHERE --admin
|
||||
```
|
||||
|
||||
And follow the prompts
|
||||
|
||||
### Reverse proxies
|
||||
|
||||
This is a tad more complex in docker than on the host itself. It
|
||||
|
||||
You've got two options.
|
||||
|
||||
#### Running caddy in a container
|
||||
|
||||
This is by far the easiest option. It'll handle HTTPS and all that for you.
|
||||
|
||||
```bash
|
||||
cp docker-resources/Caddyfile.example docker-resources/Caddyfile
|
||||
```
|
||||
|
||||
Then edit the TLD in your caddyfile to the domain you're serving on.
|
||||
|
||||
Uncomment the `caddy` section in the docker-compose file,
|
||||
then run `docker-compose up -d` again.
|
||||
|
||||
```bash
|
||||
{! installation/frontends.include !}
|
||||
|
||||
#### Further reading
|
||||
|
|
Loading…
Reference in a new issue