1
0
Fork 1
mirror of https://akkoma.dev/AkkomaGang/akkoma.git synced 2024-11-17 18:49:15 +00:00

add assistive flags for docker

This commit is contained in:
Floatingghost 2024-06-01 09:11:02 +01:00
parent 2f1569b931
commit 4450f7463b
3 changed files with 39 additions and 3 deletions

View file

@ -0,0 +1,28 @@
#!/bin/bash
set -euo pipefail
mkdir -p pgdata
mkdir -p docker-setup-tmp
# This is sorta special in that we need the generated_config.exs to make it onto the host
# We can also automate the DB setup here!
docker compose run \
--rm \
-e "PLEROMA_CTL_RPC_DISABLED=true" \
-v ./docker-setup-tmp:/opt/akkoma/config/\
akkoma ./bin/pleroma_ctl instance gen --no-sql-user --no-db-creation --dbhost db --dbname akkoma --dbuser akkoma --dbpass akkoma --listen-ip 0.0.0.0 --listen-port 4000 --static-dir /opt/akkoma/instance/ --uploads-dir /opt/akkoma/uploads/ --db-configurable true
echo ""
echo "=========================="
echo ""
echo "Setting up your database!"
docker compose start db
docker compose run \
--rm \
-e "PGPASSWORD=akkoma" \
-v "$(pwd)/docker-setup-tmp/setup_db.psql:/docker-entrypoint-initdb.d/setup_db.sql" \
db

View file

@ -37,7 +37,9 @@ def run(["gen" | rest]) do
listen_port: :string,
strip_uploads_metadata: :string,
read_uploads_description: :string,
anonymize_uploads: :string
anonymize_uploads: :string,
no_sql_user: :boolean,
no_db_creation: :boolean
],
aliases: [
o: :output,
@ -260,7 +262,9 @@ def run(["gen" | rest]) do
dbname: dbname,
dbuser: dbuser,
dbpass: dbpass,
rum_enabled: rum_enabled
rum_enabled: rum_enabled,
no_sql_user: Keyword.get(options, :no_sql_user, false),
no_db_creation: Keyword.get(options, :no_db_creation, false)
)
config_dir = Path.dirname(config_path)

View file

@ -1,5 +1,9 @@
<%= unless no_sql_user do %>
CREATE USER <%= dbuser %> WITH ENCRYPTED PASSWORD '<%= dbpass %>';
CREATE DATABASE <%= dbname %> OWNER <%= dbuser %>;
<% end %>
<%= unless no_db_creation do %>
CREATE DATABASE IF NOT EXISTS <%= dbname %> OWNER <%= dbuser %>;
<% end %>
\c <%= dbname %>;
--Extensions made by ecto.migrate that need superuser access
CREATE EXTENSION IF NOT EXISTS citext;