Compare commits

...

3 commits

Author SHA1 Message Date
Christian Fraß 15b68794eb [add] role:postgresql-for-mastodon 2024-07-30 16:18:16 +02:00
Christian Fraß 4b31dbc90a [mod] role:mastodon 2024-07-30 16:18:03 +02:00
Christian Fraß d8f9826fe0 [add] roles:mastodon:stub 2024-07-30 15:50:43 +02:00
6 changed files with 245 additions and 0 deletions

View file

@ -0,0 +1,4 @@
{
"var_mastodon_user": "mastodon",
"var_mastodon_directory": "/opt/mastodon"
}

8
roles/mastodon/info.md Normal file
View file

@ -0,0 +1,8 @@
## Beschreibung
Micro-Blogging-Dienst [Mastodon](https://joinmastodon.org/)
## Verweise
- [Mastodon Documentation | Running your own server](https://docs.joinmastodon.org/user/run-your-own/)

View file

@ -0,0 +1,169 @@
[
{
"name": "packages",
"become": true,
"ansible.builtin.apt": {
"update_cache": true,
"pkg": [
"curl",
"wget",
"gnupg",
"apt-transport-https",
"lsb-release",
"ca-certificates",
"imagemagick",
"ffmpeg",
"libpq-dev",
"libxml2-dev",
"libxslt1-dev",
"file",
"git-core",
"g++",
"libprotobuf-dev",
"protobuf-compiler",
"pkg-config",
"gcc",
"autoconf",
"bison",
"build-essential",
"libssl-dev",
"libyaml-dev",
"libreadline6-dev",
"zlib1g-dev",
"libncurses5-dev",
"libffi-dev",
"libgdbm-dev",
"nginx",
"nodejs",
"redis-server",
"redis-tools",
"postgresql",
"postgresql-contrib",
"certbot",
"python3-certbot-nginx",
"libidn11-dev",
"libicu-dev",
"libjemalloc-dev"
]
}
},
{
"name": "user",
"become": true,
"ansible.builtin.user": {
"name": "{{var_mastodon_user}}",
"create_home": true,
"home": "{{var_mastodon_directory}}"
}
},
{
"name": "ruby_environment | 1",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "git clone https://github.com/rbenv/rbenv.git ~/.rbenv"
}
},
{
"name": "ruby_environment | 2",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "echo 'export PATH=\"$HOME/.rbenv/bin:$PATH\"' >> ~/.bashrc"
}
},
{
"name": "ruby_environment | 3",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "echo 'eval \"$(rbenv init -)\"' >> ~/.bashrc"
}
},
{
"name": "ruby_environment | 4",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "bash 'git clone https://github.com/rbenv/ruby-build.git \"$(rbenv root)\"/plugins/ruby-build'"
}
},
{
"name": "ruby_environment | 5",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "RUBY_CONFIGURE_OPTS='--with-jemalloc rbenv install 3.2.3' rbenv global 3.2.3"
}
},
{
"name": "ruby_environment | 6",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "gem install bundler --no-document"
}
},
{
"name": "setup | 1",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"cmd": "git clone https://github.com/mastodon/mastodon.git live"
}
},
{
"name": "setup | 2",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "git checkout $(git tag -l | grep '^v[0-9.]*$' | sort -V | tail -n 1)"
}
},
{
"name": "setup | 3",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "bundle config deployment 'true'"
}
},
{
"name": "setup | 4",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "bundle config without 'development test'"
}
},
{
"name": "setup | 5",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "bundle install -j$(getconf _NPROCESSORS_ONLN)"
}
},
{
"name": "setup | 6",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "yarn install --pure-lockfile"
}
},
{
"name": "setup | 7",
"become": true,
"become_user": "{{var_mastodon_user}}",
"ansible.builtin.command": {
"chdir": "{{var_mastodon_directory}}/live",
"cmd": "RAILS_ENV=production bundle exec rake mastodon:setup"
}
}
]

View file

@ -0,0 +1,10 @@
{
"user": {
"mandatory": false,
"type": "string"
},
"directory": {
"mandatory": false,
"type": "string"
}
}

View file

@ -0,0 +1,5 @@
{
"var_postgresql_for_mastodon_username": "mastodon_user",
"var_postgresql_for_mastodon_password": "REPLACE_ME",
"var_postgresql_for_mastodon_schema": "mastodon"
}

View file

@ -0,0 +1,49 @@
[
{
"name": "packages",
"become": true,
"ansible.builtin.apt": {
"update_cache": true,
"pkg": [
"acl",
"python3-psycopg2"
]
}
},
{
"name": "user",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_user": {
"state": "present",
"name": "{{var_postgresql_for_mastodon_username}}",
"password": "{{var_postgresql_for_mastodon_password}}"
},
"environment": {
"PGOPTIONS": "-c password_encryption=scram-sha-256"
}
},
{
"name": "schema",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_db": {
"state": "present",
"name": "{{var_postgresql_for_mastodon_schema}}",
"owner": "{{var_postgresql_for_mastodon_username}}"
}
},
{
"name": "rights",
"become": true,
"become_user": "postgres",
"community.postgresql.postgresql_privs": {
"state": "present",
"db": "{{var_postgresql_for_mastodon_schema}}",
"objs": "ALL_IN_SCHEMA",
"roles": "{{var_postgresql_for_mastodon_username}}",
"privs": "ALL",
"grant_option": true
}
}
]