Start progress on new config
This commit is contained in:
parent
1ec14d0a2f
commit
5c9107b67f
70
.env.dist
70
.env.dist
@ -1,18 +1,3 @@
|
|||||||
#
|
|
||||||
# Note: The values of this file that are passed directly to
|
|
||||||
# pleroma need type hints to be applied correctly.
|
|
||||||
# The implemented types are int, bool, and string.
|
|
||||||
# Typed variables look like this: KEY=type:VALUE.
|
|
||||||
# Not specifying a type implies a string.
|
|
||||||
#
|
|
||||||
# In general: Your instance should work as expected if you leave the types as they are.
|
|
||||||
# That is: don't remove them, don't add them, don't change them.
|
|
||||||
# Always just change the values.
|
|
||||||
#
|
|
||||||
# You don't need to escape colons in your strings.
|
|
||||||
# PLEROMA_NAME=string:std::pleroma::coolinstance will work as expected.
|
|
||||||
#
|
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
# Script settings #
|
# Script settings #
|
||||||
#########################
|
#########################
|
||||||
@ -62,15 +47,12 @@ DOCKER_GID=1000
|
|||||||
# Database settings #
|
# Database settings #
|
||||||
###########################
|
###########################
|
||||||
|
|
||||||
# Leave POSTGRES_IP empty unless you plan to install your own database
|
# When you use the managed postgres container
|
||||||
# Leave the POSTGRES_DB, POSTGRES_USER and POSTGRES_PASSWORD as-is
|
# those will be the credentials the container is generated with.
|
||||||
# unless you use your own database.
|
|
||||||
|
|
||||||
POSTGRES_IP=
|
|
||||||
POSTGRES_DB=pleroma
|
POSTGRES_DB=pleroma
|
||||||
POSTGRES_USER=pleroma
|
POSTGRES_USER=pleroma
|
||||||
POSTGRES_PASSWORD=pleroma
|
POSTGRES_PASSWORD=pleroma
|
||||||
PLEROMA_DB_POOL_SIZE=int:16
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Pleroma Settings #
|
# Pleroma Settings #
|
||||||
@ -81,51 +63,3 @@ MIX_ENV=prod
|
|||||||
|
|
||||||
# The git tag, revision, or branch to check out on build
|
# The git tag, revision, or branch to check out on build
|
||||||
PLEROMA_VERSION=develop
|
PLEROMA_VERSION=develop
|
||||||
|
|
||||||
# The loglevel to use
|
|
||||||
# (error/warn/info/debug)
|
|
||||||
PLEROMA_LOGLEVEL=error
|
|
||||||
|
|
||||||
# The domain/scheme where pleroma will be hosted
|
|
||||||
# URL is a bare TLD
|
|
||||||
# SCHEME is the protocol without "://"
|
|
||||||
# PORT is the *external* port (ie that of your reverse proxy)
|
|
||||||
PLEROMA_URL=coolsite.moe
|
|
||||||
PLEROMA_SCHEME=https
|
|
||||||
PLEROMA_PORT=int:443
|
|
||||||
|
|
||||||
# The seed for your secret keys
|
|
||||||
# (Enter something as random as possible)
|
|
||||||
# (On linux you can try something like "dd if=/dev/urandom bs=1 count=64 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev")
|
|
||||||
PLEROMA_SECRET_KEY_BASE=
|
|
||||||
|
|
||||||
# The name of your instance
|
|
||||||
# (This is displayed in the top-left in pleroma-fe)
|
|
||||||
PLEROMA_NAME=string:coolInstance
|
|
||||||
|
|
||||||
# Your contact info
|
|
||||||
PLEROMA_ADMIN_EMAIL=admin@coolsite.moe
|
|
||||||
|
|
||||||
# How many chars a notice may have at max.
|
|
||||||
PLEROMA_MAX_NOTICE_CHARS=int:500
|
|
||||||
|
|
||||||
# Whether your instance accepts new users or not (true/false)
|
|
||||||
PLEROMA_REGISTRATIONS_OPEN=bool:true
|
|
||||||
|
|
||||||
# Enable media proxy (true/false)?
|
|
||||||
PLEROMA_MEDIA_PROXY_ENABLED=bool:false
|
|
||||||
|
|
||||||
# The url of your media proxy (if enabled) [with "http(s)://"]
|
|
||||||
PLEROMA_MEDIA_PROXY_URL=string:https://cdn.coolsite.moe
|
|
||||||
|
|
||||||
# Redirect to source on cache fail?
|
|
||||||
PLEROMA_MEDIA_PROXY_REDIRECT_ON_FAILURE=bool:true
|
|
||||||
|
|
||||||
# Whether to enable the chat feature or not
|
|
||||||
PLEROMA_CHAT_ENABLED=bool:true
|
|
||||||
|
|
||||||
# Where to store uploads.
|
|
||||||
# This is only relevant inside the container.
|
|
||||||
# The host path is always $DOCKER_DATADIR/uploads.
|
|
||||||
# So, you probably don't need to change this.
|
|
||||||
PLEROMA_UPLOADS_PATH=/uploads
|
|
||||||
|
@ -29,6 +29,7 @@ RUN \
|
|||||||
&& dpkg -i erlang-solutions_1.0_all.deb \
|
&& dpkg -i erlang-solutions_1.0_all.deb \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends esl-erlang elixir \
|
&& apt-get install -y --no-install-recommends esl-erlang elixir \
|
||||||
|
&& apt-get install -y ruby \
|
||||||
\
|
\
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
111
config.dist.yml
Normal file
111
config.dist.yml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
version: 1
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pleroma settings
|
||||||
|
#
|
||||||
|
# You can enter any config in here that you want.
|
||||||
|
# Pleroma-Docker will try to translate it into elixir for you.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
#
|
||||||
|
# :foo:
|
||||||
|
# Bar.Baz:
|
||||||
|
# x: true
|
||||||
|
#
|
||||||
|
# becomes `config :foo, Bar.Baz, x: true`.
|
||||||
|
#
|
||||||
|
# It is assumed that all config keys that have to be passed through to
|
||||||
|
# pleroma must start with an atom on the first layer (eg :pleroma).
|
||||||
|
#
|
||||||
|
|
||||||
|
app:
|
||||||
|
# The loglevel to use in pleroma.
|
||||||
|
:logger:
|
||||||
|
level: info
|
||||||
|
|
||||||
|
:pleroma:
|
||||||
|
Pleroma.Repo:
|
||||||
|
# Credentials for your database.
|
||||||
|
# You should leave this as-is if you want to use the managed db container.
|
||||||
|
hostname: db
|
||||||
|
username: pleroma
|
||||||
|
password: pleroma
|
||||||
|
database: pleroma
|
||||||
|
pool_size: 16
|
||||||
|
|
||||||
|
Pleroma.Web.Endpoint:
|
||||||
|
# Location where your instance will be reachable.
|
||||||
|
url:
|
||||||
|
<T>: Array
|
||||||
|
scheme: https
|
||||||
|
host: coolsite.moe
|
||||||
|
port: 443
|
||||||
|
|
||||||
|
# Base for your secret keys.
|
||||||
|
# Better make this random.
|
||||||
|
secret_key_base: asdf0815
|
||||||
|
|
||||||
|
Pleroma.Upload:
|
||||||
|
# Where to store your uploads.
|
||||||
|
# You should probably leave this as-is.
|
||||||
|
# /uploads will be mounted into ::docker::datadir.
|
||||||
|
uploads: /uploads
|
||||||
|
|
||||||
|
# Remove metadata from uploads?
|
||||||
|
strip_exif: true
|
||||||
|
|
||||||
|
:chat:
|
||||||
|
# Enable chat functionality?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
:media_proxy:
|
||||||
|
# Enable the proxy?
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# Emit a 302 to the original resource when uncached?
|
||||||
|
redirect_on_failure: true
|
||||||
|
|
||||||
|
# Where your proxy is reachable
|
||||||
|
base_url: https://media.coolsite.moe
|
||||||
|
|
||||||
|
:instance:
|
||||||
|
# The name of your instance.
|
||||||
|
name: super cool stuff club
|
||||||
|
|
||||||
|
# Short description of your instance
|
||||||
|
description: we do super cool stuff in super cool stuff club
|
||||||
|
|
||||||
|
# The admin's email address.
|
||||||
|
email: admin@coolsite.moe
|
||||||
|
|
||||||
|
# How many chars a notice may have at max.
|
||||||
|
limit: 4096
|
||||||
|
|
||||||
|
# May new members sign up?
|
||||||
|
registrations_open: true
|
||||||
|
|
||||||
|
# Allow connections to other instances?
|
||||||
|
# (Turn this off for testing)
|
||||||
|
federating: true
|
||||||
|
|
||||||
|
# The rewrite policies / quarantines to enable.
|
||||||
|
# This is a powerful feature which should be used with care.
|
||||||
|
# Take a look at https://git.pleroma.social/pleroma/pleroma/wikis/Message%20rewrite%20facility%20configuration%20(how%20to%20block%20instances).
|
||||||
|
# Then uncomment only the things you really need
|
||||||
|
|
||||||
|
# quarantined_instances:
|
||||||
|
# - badguys.moe
|
||||||
|
|
||||||
|
# rewrite_policy:
|
||||||
|
# - Pleroma.Web.ActivityPub.MRF.SimplePolicy
|
||||||
|
|
||||||
|
# :mrf_simple:
|
||||||
|
# media_removal:
|
||||||
|
# - illegalporn.biz
|
||||||
|
# media_nsfw:
|
||||||
|
# - porn.biz
|
||||||
|
# - porn.business
|
||||||
|
# reject:
|
||||||
|
# - spam.com
|
||||||
|
# federated_timeline_removal:
|
||||||
|
# - spam.university
|
44
config_parser/parser.rb
Executable file
44
config_parser/parser.rb
Executable file
@ -0,0 +1,44 @@
|
|||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'yaml'
|
||||||
|
require 'json'
|
||||||
|
|
||||||
|
config = YAML.load_file(ARGV[0])
|
||||||
|
|
||||||
|
if config["version"] != 1
|
||||||
|
raise "Incompatible config version (#{config["version"]} != 1)"
|
||||||
|
end
|
||||||
|
|
||||||
|
buf = "use Mix.Config\n\n"
|
||||||
|
|
||||||
|
config["app"].each do |atom, content|
|
||||||
|
content.each do |sub, settings|
|
||||||
|
buf += "config :#{atom}, #{sub.is_a?(Symbol) ? ":#{sub}" : sub}"
|
||||||
|
|
||||||
|
if !settings.is_a? Hash
|
||||||
|
buf += ": #{settings.to_json}\n"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
|
||||||
|
settings.each do |name, value|
|
||||||
|
if value.is_a?(Hash) && value["<T>"] == "Array"
|
||||||
|
value.delete("<T>")
|
||||||
|
|
||||||
|
buf += ", #{name}: ["
|
||||||
|
|
||||||
|
value.each do |k, v|
|
||||||
|
buf += "#{k}: #{v.to_json},"
|
||||||
|
end
|
||||||
|
buf.chop!
|
||||||
|
|
||||||
|
buf += "]"
|
||||||
|
else
|
||||||
|
buf += ", #{name}: #{value.to_json}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
buf += "\n"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts buf
|
@ -88,7 +88,7 @@ define(<env_inline_fb>, <${upcase($1):-$2}>)
|
|||||||
"env(<pleroma_version>)",
|
"env(<pleroma_version>)",
|
||||||
"env(<docker_uid>)",
|
"env(<docker_uid>)",
|
||||||
"env(<docker_gid>)",
|
"env(<docker_gid>)",
|
||||||
"env_fb(<pleroma_uploads_path>, </uploads>)",
|
"env_fb(<pleroma_uploads_path>, </uploads>)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"restart": "unless-stopped",
|
"restart": "unless-stopped",
|
||||||
@ -96,31 +96,12 @@ define(<env_inline_fb>, <${upcase($1):-$2}>)
|
|||||||
ifelse(__SCRIPT_DEPLOY_POSTGRES, true, <"db">)
|
ifelse(__SCRIPT_DEPLOY_POSTGRES, true, <"db">)
|
||||||
],
|
],
|
||||||
"environment": [
|
"environment": [
|
||||||
"env_fb(<mix_env>, <prod>)",
|
"env_fb(<mix_env>, <prod>)"
|
||||||
|
|
||||||
"env_fb(<postgres_ip>, <db>)",
|
|
||||||
"env(<postgres_db>)",
|
|
||||||
"env(<postgres_user>)",
|
|
||||||
"env(<postgres_password>)",
|
|
||||||
|
|
||||||
"env(<pleroma_url>)",
|
|
||||||
"env(<pleroma_loglevel>)",
|
|
||||||
"env(<pleroma_scheme>)",
|
|
||||||
"env(<pleroma_port>)",
|
|
||||||
"env(<pleroma_secret_key_base>)",
|
|
||||||
"env(<pleroma_name>)",
|
|
||||||
"env(<pleroma_admin_email>)",
|
|
||||||
"env(<pleroma_max_notice_chars>)",
|
|
||||||
"env(<pleroma_registrations_open>)",
|
|
||||||
"env(<pleroma_media_proxy_enabled>)",
|
|
||||||
"env(<pleroma_media_proxy_redirect_on_failure>)",
|
|
||||||
"env(<pleroma_media_proxy_url>)",
|
|
||||||
"env(<pleroma_db_pool_size>)",
|
|
||||||
"env(<pleroma_chat_enabled>)",
|
|
||||||
"env_fb(<pleroma_uploads_path>, </uploads>)"
|
|
||||||
],
|
],
|
||||||
"volumes": [
|
"volumes": [
|
||||||
"./custom.d:/custom.d",
|
"./custom.d:/custom.d",
|
||||||
|
"./config.yml:/conf/config.yml:ro",
|
||||||
|
"./config_parser/parser.rb:/conf/parser.rb:ro",
|
||||||
"env_inline(<docker_datadir>)/uploads:env_inline_fb(<pleroma_uploads_path>, </uploads>)"
|
"env_inline(<docker_datadir>)/uploads:env_inline_fb(<pleroma_uploads_path>, </uploads>)"
|
||||||
],
|
],
|
||||||
"labels": [
|
"labels": [
|
||||||
|
@ -1,71 +0,0 @@
|
|||||||
use Mix.Config
|
|
||||||
|
|
||||||
defmodule Docker do
|
|
||||||
def env(shortname, verbatim \\ false) do
|
|
||||||
# Get var
|
|
||||||
name = ((if verbatim, do: "", else: "pleroma_") <> Atom.to_string(shortname)) |> String.upcase()
|
|
||||||
raw_var = System.get_env(name)
|
|
||||||
|
|
||||||
if raw_var == nil do
|
|
||||||
raise "Could not find #{name} in environment. Please define it and try again."
|
|
||||||
end
|
|
||||||
|
|
||||||
# Match type and cast if needed
|
|
||||||
if String.contains?(raw_var, ":") do
|
|
||||||
var_parts = String.split(raw_var, ":", parts: 2)
|
|
||||||
|
|
||||||
type = Enum.at(var_parts, 0)
|
|
||||||
var = Enum.at(var_parts, 1)
|
|
||||||
|
|
||||||
func = case type do
|
|
||||||
"int" -> fn(x) -> Integer.parse(x) |> elem(0) end
|
|
||||||
"bool" -> fn(x) -> x == "true" end
|
|
||||||
"string" -> fn(x) -> x end
|
|
||||||
_ -> if verbatim do
|
|
||||||
fn(x) -> x end
|
|
||||||
else
|
|
||||||
raise "Unknown type #{type} used in variable #{raw_var}."
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
func.(var)
|
|
||||||
else
|
|
||||||
raw_var
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
config :logger, level: String.to_atom(Docker.env(:loglevel) || "info")
|
|
||||||
|
|
||||||
config :pleroma, Pleroma.Web.Endpoint,
|
|
||||||
url: [
|
|
||||||
host: Docker.env(:url),
|
|
||||||
scheme: Docker.env(:scheme),
|
|
||||||
port: Docker.env(:port)
|
|
||||||
],
|
|
||||||
secret_key_base: Docker.env(:secret_key_base)
|
|
||||||
|
|
||||||
config :pleroma, Pleroma.Upload,
|
|
||||||
uploads: Docker.env(:uploads_path)
|
|
||||||
|
|
||||||
config :pleroma, :chat,
|
|
||||||
enabled: Docker.env(:chat_enabled)
|
|
||||||
|
|
||||||
config :pleroma, :instance,
|
|
||||||
name: Docker.env(:name),
|
|
||||||
email: Docker.env(:admin_email),
|
|
||||||
limit: Docker.env(:max_notice_chars),
|
|
||||||
registrations_open: Docker.env(:registrations_open)
|
|
||||||
|
|
||||||
config :pleroma, :media_proxy,
|
|
||||||
enabled: Docker.env(:media_proxy_enabled),
|
|
||||||
redirect_on_failure: Docker.env(:media_proxy_redirect_on_failure),
|
|
||||||
base_url: Docker.env(:media_proxy_url)
|
|
||||||
|
|
||||||
config :pleroma, Pleroma.Repo,
|
|
||||||
adapter: Ecto.Adapters.Postgres,
|
|
||||||
username: Docker.env(:postgres_user, true),
|
|
||||||
password: Docker.env(:postgres_password, true),
|
|
||||||
database: Docker.env(:postgres_db, true),
|
|
||||||
hostname: Docker.env(:postgres_ip, true),
|
|
||||||
pool_size: Docker.env(:db_pool_size)
|
|
@ -3,7 +3,18 @@
|
|||||||
set -e
|
set -e
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
mix deps.get
|
# Generate a config file
|
||||||
|
ruby /config/parser.rb /config/config.yml > runtime-config.exs
|
||||||
|
|
||||||
|
# Recompile if needed
|
||||||
|
if [[ ! -z "$RECOMPILE" ]]; then
|
||||||
|
mix deps.get
|
||||||
|
mix compile
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Migrate db
|
||||||
mix ecto.create
|
mix ecto.create
|
||||||
mix ecto.migrate
|
mix ecto.migrate
|
||||||
|
|
||||||
|
# Off we go!
|
||||||
exec mix phx.server
|
exec mix phx.server
|
||||||
|
Loading…
Reference in New Issue
Block a user