Compare commits

..

No commits in common. "8cf20378770c28d802cbee3819f1a95fd8351587" and "eba3cce77b45e89028f7e6bfa708b469b7416914" have entirely different histories.

16 changed files with 202 additions and 156 deletions

View file

@ -1,33 +1,17 @@
.*
*.md
*.yml
*file
AGPL-3
CC-BY-4.0
CC-BY-SA-4.0
COPYING
_build
benchmarks
ci
deps
docs/site
docs/venv
config/*.env
config/*.secret.exs
config/generated_config.exs
config/runtime.exs
config/setup_db*.psql
scripts
*file
elixir_buildpack.config
test/
test
etc
static
benchmarks
docs/site
docker-db
uploads
instance
docker-db
capture.pcap
erl_crash.dump
coveralls.json
SIGNING_KEY.pub
# Required to get version
!.git

3
.gitignore vendored
View file

@ -25,7 +25,6 @@ vm.args
docker-resources/Dockerfile
docker-resources/Caddyfile
pgdata
uploads
# Prevent committing custom emojis
/priv/static/emoji/custom/*
@ -79,5 +78,3 @@ docs/venv
# docker stuff
docker-db
*.iml
static
etc

View file

@ -17,6 +17,8 @@ variables:
branch:
- develop
- stable
- refs/tags/v*
- refs/tags/stable-*
- &on-stable
when:
event:
@ -24,6 +26,14 @@ variables:
- tag
branch:
- stable
- refs/tags/stable-*
- &on-point-release
when:
event:
- push
branch:
- develop
- stable
- &on-pr-open
when:
event:
@ -94,7 +104,7 @@ pipeline:
# Canonical amd64-musl
musl:
image: hexpm/elixir:1.14.3-erlang-25.2.2-alpine-3.18.0
<<: *on-stable
<<: *on-release
environment:
MIX_ENV: prod
commands:
@ -109,9 +119,31 @@ pipeline:
release-musl:
image: akkoma/releaser
<<: *on-stable
<<: *on-release
secrets: *scw-secrets
commands:
- export SOURCE=akkoma-amd64-musl.zip
- export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-amd64-musl.zip
- /bin/sh /entrypoint.sh
docs:
<<: *on-point-release
secrets:
- SCW_ACCESS_KEY
- SCW_SECRET_KEY
- SCW_DEFAULT_ORGANIZATION_ID
environment:
CI: "true"
image: python:3.10-slim
commands:
- apt-get update && apt-get install -y rclone wget git zip
- wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_amd64
- mv scaleway-cli_2.5.1_linux_amd64 scaleway-cli
- chmod +x scaleway-cli
- ./scaleway-cli object config install type=rclone
- cd docs
- pip install -r requirements.txt
- mkdocs build
- zip -r docs.zip site/*
- cd site
- rclone copy . scaleway:akkoma-docs/$CI_COMMIT_BRANCH/

View file

@ -15,8 +15,10 @@ variables:
- push
- tag
branch:
- stable
- develop
- stable
- refs/tags/v*
- refs/tags/stable-*
- &on-stable
when:
event:
@ -24,6 +26,14 @@ variables:
- tag
branch:
- stable
- refs/tags/stable-*
- &on-point-release
when:
event:
- push
branch:
- develop
- stable
- &on-pr-open
when:
event:
@ -58,12 +68,14 @@ pipeline:
secrets: *scw-secrets
commands:
- export SOURCE=akkoma-ubuntu-jammy.zip
- export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-ubuntu-jammy.zip
- /bin/sh /entrypoint.sh
- export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-arm64-ubuntu-jammy.zip
- /bin/sh /entrypoint.sh
debian-bullseye:
image: hexpm/elixir:1.14.3-erlang-25.2.2-debian-bullseye-20230109
<<: *on-stable
<<: *on-release
environment:
MIX_ENV: prod
DEBIAN_FRONTEND: noninteractive
@ -80,7 +92,7 @@ pipeline:
release-debian:
image: akkoma/releaser:arm64
<<: *on-stable
<<: *on-release
secrets: *scw-secrets
commands:
- export SOURCE=akkoma-arm64.zip
@ -92,7 +104,7 @@ pipeline:
# Canonical arm64-musl
musl:
image: hexpm/elixir:1.14.3-erlang-25.2.2-alpine-3.18.0
<<: *on-stable
<<: *on-release
environment:
MIX_ENV: prod
commands:
@ -107,9 +119,31 @@ pipeline:
release-musl:
image: akkoma/releaser:arm64
<<: *on-stable
<<: *on-release
secrets: *scw-secrets
commands:
- export SOURCE=akkoma-arm64-musl.zip
- export DEST=scaleway:akkoma-updates/$${CI_COMMIT_TAG:-"$CI_COMMIT_BRANCH"}/akkoma-arm64-musl.zip
- /bin/sh /entrypoint.sh
docs:
<<: *on-point-release
secrets:
- SCW_ACCESS_KEY
- SCW_SECRET_KEY
- SCW_DEFAULT_ORGANIZATION_ID
environment:
CI: "true"
image: python:3.10-slim
commands:
- apt-get update && apt-get install -y rclone wget git zip
- wget https://github.com/scaleway/scaleway-cli/releases/download/v2.5.1/scaleway-cli_2.5.1_linux_arm64
- mv scaleway-cli_2.5.1_linux_arm64 scaleway-cli
- chmod +x scaleway-cli
- ./scaleway-cli object config install type=rclone
- cd docs
- pip install -r requirements.txt
- mkdocs build
- zip -r docs.zip site/*
- cd site
- rclone copy . scaleway:akkoma-docs/$CI_COMMIT_BRANCH/

View file

@ -11,14 +11,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added a new configuration option to the MediaProxy feature that allows the blocking of specific domains from using the media proxy or being explicitly allowed by the Content-Security-Policy.
- Please make sure instances you wanted to block media from are not in the MediaProxy `whitelist`, and instead use `blocklist`.
- `OnlyMedia` Upload Filter to simplify restricting uploads to audio, image, and video types
- ARM64 OTP builds
- Ubuntu22 builds are available for develop and stable
- other distributions are stable only
## Changed
- Alpine OTP builds are now from alpine 3.18, which is SSLv3 compatible.
If you use alpine OTP builds you will have to update your local system.
## Fixed

View file

@ -1,69 +1,34 @@
FROM elixir:1.14-alpine as build
FROM hexpm/elixir:1.14.3-erlang-25.2.2-alpine-3.18.0
ENV MIX_ENV=prod
ENV ERL_EPMD_ADDRESS=127.0.0.1
ARG BUILD_DIR=/opt/akkoma/
ARG UID=1000
ARG GID=1000
ARG HOME=/opt/akkoma
RUN addgroup -g ${GID} akkoma \
&& adduser -u ${UID} -G akkoma -s /bin/sh -D akkoma \
&& apk add --no-cache \
git \
gcc \
g++ \
musl-dev \
make \
cmake \
file-dev
LABEL org.opencontainers.image.title="akkoma" \
org.opencontainers.image.description="Akkoma for Docker" \
org.opencontainers.image.vendor="akkoma.dev" \
org.opencontainers.image.documentation="https://docs.akkoma.dev/stable/" \
org.opencontainers.image.licenses="AGPL-3.0" \
org.opencontainers.image.url="https://akkoma.dev" \
org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.created=$BUILD_DATE
WORKDIR ${BUILD_DIR}
COPY . .
RUN mkdir -p "${BUILD_DIR}_build/" \
&& mix local.hex --force \
&& mix local.rebar --force \
&& mix deps.get --only prod \
&& mix release --path "${BUILD_DIR}_build"
FROM elixir:1.14-alpine as web
ENV MIX_ENV=prod
ENV ERL_EPMD_ADDRESS=127.0.0.1
ARG DATA_DIR=/var/lib/akkoma/
ARG INSTALL_DIR=/opt/akkoma/
ARG CONFIG_DIR=/etc/akkoma/
ARG UID=1000
ARG GID=1000
RUN addgroup -g ${GID} akkoma \
&& adduser -u ${UID} -G akkoma -s /bin/sh -D akkoma \
&& apk add --no-cache \
exiftool \
ffmpeg \
imagemagick \
libmagic \
ncurses \
postgresql-client
RUN mkdir -p "${DATA_DIR}uploads/" \
&& mkdir -p "${DATA_DIR}static/" \
&& mkdir -p "${INSTALL_DIR}" \
&& mkdir -p "${CONFIG_DIR}"
COPY --from=build ${INSTALL_DIR}_build/ ${INSTALL_DIR}
COPY ./docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
ENV PATH="/opt/akkoma/bin:${PATH}"
WORKDIR ${INSTALL_DIR}
RUN apk add git gcc g++ musl-dev make cmake file-dev exiftool ffmpeg imagemagick libmagic ncurses postgresql-client
EXPOSE 4000
ENTRYPOINT [ "docker-entrypoint.sh" ]
ARG UID=1000
ARG GID=1000
ARG UNAME=akkoma
CMD [ "pleroma", "start" ]
RUN addgroup -g $GID $UNAME
RUN adduser -u $UID -G $UNAME -D -h $HOME $UNAME
WORKDIR /opt/akkoma
USER $UNAME
RUN mix local.hex --force &&\
mix local.rebar --force
CMD ["/opt/akkoma/docker-entrypoint.sh"]

View file

@ -1,24 +1,10 @@
## What is This?
This is a fork of [AkkomaGang/akkoma](https://akkoma.dev/AkkomaGang/akkoma/), with an opinionated Docker setup.
The differences between the upstream repository are described below:
- Uses the official Elixir image from Docker Hub
- Automatically builds the Akkoma backend when building the Docker image, instead of requiring complex commands after pulling/building images
- Files/directories to mount are minified and completely separated from the repository files, allowing better control over file permissions
- Has a better Docker entry point where you can control the backend without using pre-written shell scripts
- Supports Podman quite well
---
## akkoma
*a smallish microblogging platform, aka the cooler pleroma*
![English OK](https://img.shields.io/badge/English-OK-blueviolet?style=for-the-badge) ![日本語OK](https://img.shields.io/badge/%E6%97%A5%E6%9C%AC%E8%AA%9E-OK-blueviolet?style=for-the-badge)
![English OK](https://img.shields.io/badge/English-OK-blueviolet) ![日本語OK](https://img.shields.io/badge/%E6%97%A5%E6%9C%AC%E8%AA%9E-OK-blueviolet)
## About
## About
This is a fork of Pleroma, which is a microblogging server software that can federate (= exchange messages with) other servers that support ActivityPub. What that means is that you can host a server for yourself or your friends and stay in control of your online identity, but still exchange messages with people on larger servers. Akkoma will federate with all servers that implement ActivityPub, like Friendica, GNU Social, Hubzilla, Mastodon, Misskey, Peertube, and Pixelfed.
@ -37,7 +23,6 @@ This should not be considered a one-for-one match with pleroma; it is more opini
bad depending on your view)
For example, Akkoma has:
- Custom Emoji reactions (compatible with misskey)
- Misskey-flavoured markdown support
- Elasticsearch and Meilisearch support for search
@ -53,11 +38,9 @@ Take a look at the Changelog if you want a full list of recent changes, everythi
## Installation
### OTP releases (Recommended)
If you are running Linux (glibc or musl) on x86, the recommended way to install Akkoma is by using OTP releases. OTP releases are as close as you can get to binary releases with Erlang/Elixir. The release is self-contained, and provides everything needed to boot it. The installation instructions are available [here](https://docs.akkoma.dev/stable/installation/otp_en/).
### From Source
If your platform is not supported, or you just want to be able to edit the source code easily, you may install Akkoma from source.
- [Alpine Linux](https://docs.akkoma.dev/stable/installation/alpine_linux_en/)
@ -69,15 +52,12 @@ If your platform is not supported, or you just want to be able to edit the sourc
- [OpenBSD](https://docs.akkoma.dev/stable/installation/openbsd_en/)
### Docker
Docker installation is supported via [this setup](https://docs.akkoma.dev/stable/installation/docker_en/)
### Packages
Akkoma is packaged for [YunoHost](https://yunohost.org) and can be found and installed from the [YunoHost app catalogue](https://yunohost.org/#/apps).
### Compilation Troubleshooting
If you ever encounter compilation issues during the updating of Akkoma, you can try these commands and see if they fix things:
- `mix deps.clean --all`
@ -86,6 +66,5 @@ If you ever encounter compilation issues during the updating of Akkoma, you can
- `rm -r _build`
## Documentation
- https://docs.akkoma.dev/stable
- https://docs.akkoma.dev/develop

View file

@ -1,33 +1,61 @@
# This file is for testing only, as I don't recommend using Docker Compose in a production environment
version: "3.7"
services:
db:
image: postgres:14-alpine
image: akkoma-db:latest
build: ./docker-resources/database
restart: unless-stopped
environment:
POSTGRES_DB: akkoma
POSTGRES_USER: akkoma
POSTGRES_PASSWORD: akkoma
# Comment out the volume below if you encounter any permission errors
user: ${DOCKER_USER}
environment: {
# This might seem insecure but is usually not a problem.
# You should leave this at the "akkoma" default.
# The DB is only reachable by containers in the same docker network,
# and is not exposed to the open internet.
#
# If you do change this, remember to update "config.exs".
POSTGRES_DB: akkoma,
POSTGRES_USER: akkoma,
POSTGRES_PASSWORD: akkoma,
}
env_file:
- .env
volumes:
- ./docker-db/:/var/lib/postgresql/data/:Z
- type: bind
source: ./pgdata
target: /var/lib/postgresql/data
akkoma:
image: akkoma:latest
build: .
restart: unless-stopped
environment:
MIX_ENV: prod
ERL_EPMD_ADDRESS: 127.0.0.1
DB_NAME: akkoma
DB_USER: akkoma
DB_PASS: akkoma
env_file:
- .env
links:
- db
ports:
- "0.0.0.0:4000:4000"
ports: [
# Uncomment/Change port mappings below as needed.
# The left side is your host machine, the right one is the akkoma container.
# You can prefix the left side with an ip.
# Webserver (for reverse-proxies outside of docker)
# If you use a dockerized proxy, you can leave this commented
# and use a container link instead.
"127.0.0.1:4000:4000",
]
volumes:
- ./static/:/var/lib/akkoma/static/:Z
- ./uploads/:/var/lib/akkoma/uploads/:Z
- ./etc/:/etc/akkoma/:Z
- .:/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
# - ./caddy-data:/data
# - ./caddy-config:/config

View file

@ -1,18 +1,14 @@
#!/bin/sh
#!/bin/ash
set -e
if [ "$1" = 'pleroma' ] || [ "$1" = 'pleroma_ctl' ]; then
echo "-- Waiting for database..."
while ! pg_isready -U "${DB_USER:-pleroma}" -d postgres://"${DB_HOST:-db}:5432/${DB_NAME:-pleroma}" -t 1; do
echo "-- Waiting for database..."
while ! pg_isready -U ${DB_USER:-pleroma} -d postgres://${DB_HOST:-db}:5432/${DB_NAME:-pleroma} -t 1; do
sleep 1s
done
fi
done
if [ "$1" = 'pleroma' ]; then
echo "-- Running migrations..."
pleroma_ctl migrate
echo "-- Running migrations..."
mix ecto.migrate
echo "-- Starting!"
fi
exec "$@"
echo "-- Starting!"
mix phx.server

View 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
}

4
docker-resources/build.sh Executable file
View file

@ -0,0 +1,4 @@
#!/bin/sh
docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) akkoma
docker compose build --build-arg UID=$(id -u) --build-arg GID=$(id -g) db

View 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

View file

@ -0,0 +1,5 @@
MIX_ENV=prod
ERL_EPMD_ADDRESS=127.0.0.1
DB_NAME=akkoma
DB_USER=akkoma
DB_PASS=akkoma

3
docker-resources/manage.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
docker compose run --rm akkoma $@

View file

@ -22,9 +22,9 @@ Use the following mapping to figure out your flavour:
| distribution | architecture | flavour | available branches |
| --------------- | ------------------ | ------------------- | ------------------- |
| debian bullseye | amd64 | amd64 | develop, stable |
| debian bullseye | arm64 | arm64 | stable |
| debian bullseye | arm64 | arm64 | develop, stable |
| ubuntu focal | amd64 | amd64 | develop, stable |
| ubuntu focal | arm64 | arm64 | stable |
| ubuntu focal | arm64 | arm64 | develop, stable |
| ubuntu jammy | amd64 | amd64-ubuntu-jammy | develop, stable |
| ubuntu jammy | arm64 | arm64-ubuntu-jammy | develop, stable |
| alpine | amd64 | amd64-musl | stable |

3
uploads/.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
# Git will ignore everything in this directory except this file.
*
!.gitignore