Removed pleroma src based install.
authorLuke Hoersten <luke@hoersten.org>
Mon, 20 Jan 2020 14:19:05 -0600
changeset 91 d1406d67c758
parent 90 08764af85bda
child 92 d4924111ce28
Removed pleroma src based install.
roles/pleroma/defaults/main.yaml
roles/pleroma/handlers/main.yaml
roles/pleroma/tasks/main.yaml
roles/pleroma/templates/pleroma.cloudflare.nginx.conf.j2
roles/pleroma/templates/pleroma.nginx.conf.j2
roles/pleroma/templates/pleroma.service.j2
roles/pleroma/templates/prod.secret.exs.j2
roles/pleroma/templates/setup_db.psql.j2
--- a/roles/pleroma/defaults/main.yaml	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
----
-
-pleroma_user: "pleroma"
-
-pleroma_host: "localhost"
-pleroma_port: 4000
-pleroma_scheme: "http"
-
-pleroma_proxy_pass: "{{pleroma_scheme}}://{{pleroma_host}}:{{pleroma_port}}"
-
-pleroma_link_host: "localhost"
-pleroma_link_port: "443"
-pleroma_link_scheme: "https"
-
-pleroma_instance_name: "{{pleroma_link_host}}"
-pleroma_desc: "A Pleroma fediverse instance."
-pleroma_admin_email: "admin@{{pleroma_link_host}}"
-pleroma_char_limit: 5000
-pleroma_signup_open: "true"
-pleroma_db_host: "localhost"
-pleroma_db_superuser: "postgres"
-
-pleroma_version: "v1.1.6"
-
-pleroma_apt_packages:
-  - "elixir"
-  - "git"
-  - "build-essential"
--- a/roles/pleroma/handlers/main.yaml	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
----
-
-- name: restart pleroma
-  become: yes
-  systemd: name="{{pleroma_user}}" state="restarted" daemon_reload="yes"
--- a/roles/pleroma/tasks/main.yaml	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
----
-
-- name: add erland solutions key
-  become: yes
-  apt_key: url="http://packages.erlang-solutions.com/debian/erlang_solutions.asc"
-
-- name: install erland solutions repo
-  become: yes
-  apt_repository: repo="deb http://binaries.erlang-solutions.com/debian buster contrib"
-
-- name: update apt package cache
-  become: yes
-  apt: upgrade="dist" update_cache="yes" cache_valid_time="3600"
-
-- name: install pleroma apt packages
-  become: yes
-  apt: name="{{pleroma_apt_packages}}"
-
-- name: add users
-  become: yes
-  user: name="{{pleroma_user}}" shell="/bin/bash"
-
-- name: checkout plemora
-  become: yes
-  become_user: "{{pleroma_user}}"
-  git:
-    repo: "https://git.pleroma.social/pleroma/pleroma.git"
-    dest: "~{{pleroma_user}}/pleroma"
-    version: "{{pleroma_version}}"
-    force: yes
-
-- name: install pleroma config
-  template:
-    src: "prod.secret.exs.j2"
-    dest: "~{{pleroma_user}}/pleroma/config/prod.secret.exs"
-    owner: "{{pleroma_user}}"
-    group: "{{pleroma_user}}"
-    mode: "0600"
-  become: yes
-  notify: restart pleroma
-
-- name: install pleroma db schema file
-  template:
-    src: "setup_db.psql.j2"
-    dest: "/tmp/setup_db.psql"
-    owner: "{{pleroma_db_superuser}}"
-    group: "{{pleroma_db_superuser}}"
-    mode: "0600"
-  become: yes
-
-- name: install pleroma psql
-  become: yes
-  become_user: "{{pleroma_db_superuser}}"
-  command: "psql -f /tmp/setup_db.psql"
-  notify: restart pleroma
-
-- name: migrate db
-  become: yes
-  become_user: "{{pleroma_user}}"
-  command: "{{item}}"
-  args:
-    chdir: "~{{pleroma_user}}/pleroma/"
-  with_items:
-    - "mix local.hex --force"
-    - "mix local.rebar --force"
-    - "mix deps.get"
-    - "mix ecto.migrate"
-  notify: restart pleroma
-  environment:
-    MIX_ENV: "prod"
-
-- name: install pleroma systemd service
-  template:
-    src: "pleroma.service.j2"
-    dest: "/lib/systemd/system/{{pleroma_user}}.service"
-    owner: "{{pleroma_user}}"
-    group: "{{pleroma_user}}"
-    mode: "0660"
-  become: yes
-
-- name: enable pleroma systemd service
-  systemd: name="{{pleroma_user}}" enabled="yes" state="started"
-  become: yes
--- a/roles/pleroma/templates/pleroma.cloudflare.nginx.conf.j2	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-# default nginx site config for Pleroma
-#
-# Simple installation instructions:
-# 1. Install your TLS certificate, possibly using Let's Encrypt.
-# 2. Replace 'example.tld' with your instance's domain wherever it appears.
-# 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
-#    in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.
-
-proxy_cache_path /tmp/{{pleroma_user}}-pleroma-media-cache levels=1:2 keys_zone={{pleroma_user}}-pleroma_media_cache:10m max_size=10g
-                 inactive=720m use_temp_path=off;
-
-server {
-    listen {{nginx_port}};
-    # listen [::]:{{nginx_port}};
-    server_name _;
-    return 301 https://$host$request_uri;
-}
-
-# Enable SSL session caching for improved performance
-ssl_session_cache shared:ssl_session_cache:10m;
-
-server {
-    listen {{nginx_ssl_port}} ssl http2;
-    # listen [::]:{{nginx_ssl_port}} ssl ipv6only=on;
-    server_name _;
-
-    ssl_certificate {{nginx_ssl_cert}};
-    ssl_certificate_key {{nginx_ssl_privkey}};
-    include /etc/letsencrypt/options-ssl-nginx.conf;
-    # ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
-
-    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
-    ssl_stapling on;
-    ssl_stapling_verify on;
-
-    add_header Strict-Transport-Security "max-age=31536000" always;
-
-    gzip_vary on;
-    gzip_proxied any;
-    gzip_comp_level 6;
-    gzip_buffers 16 8k;
-    gzip_http_version 1.1;
-    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
-
-    # the nginx default is 1m, not enough for large media uploads
-    client_max_body_size 16m;
-
-    location / {
-        add_header X-XSS-Protection "1; mode=block";
-        add_header X-Permitted-Cross-Domain-Policies none;
-        add_header X-Frame-Options DENY;
-        add_header X-Content-Type-Options nosniff;
-        add_header Referrer-Policy same-origin;
-        add_header X-Download-Options noopen;
-
-        add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
-
-        proxy_http_version 1.1;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-        proxy_set_header Host $http_host;
-
-        proxy_pass {{pleroma_proxy_pass}};
-
-        client_max_body_size 16m;
-    }
-
-    location /proxy {
-        proxy_cache {{pleroma_user}}-pleroma_media_cache;
-        proxy_cache_lock on;
-        proxy_ignore_client_abort on;
-        proxy_pass {{pleroma_proxy_pass}};
-    }
-}
--- a/roles/pleroma/templates/pleroma.nginx.conf.j2	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-# default nginx site config for Pleroma
-#
-# Simple installation instructions:
-# 1. Install your TLS certificate, possibly using Let's Encrypt.
-# 2. Replace 'example.tld' with your instance's domain wherever it appears.
-# 3. Copy this file to /etc/nginx/sites-available/ and then add a symlink to it
-#    in /etc/nginx/sites-enabled/ and run 'nginx -s reload' or restart nginx.
-
-proxy_cache_path /tmp/{{pleroma_user}}-pleroma-media-cache levels=1:2 keys_zone={{pleroma_user}}-pleroma_media_cache:10m max_size=10g
-                 inactive=720m use_temp_path=off;
-
-server {
-    listen {{nginx_port}};
-    # listen [::]:{{nginx_port}};
-    server_name {{nginx_server_name}};
-    return 301 https://$server_name$request_uri;
-
-    # Uncomment this if you need to use the 'webroot' method with certbot. Make sure
-    # that you also create the .well-known/acme-challenge directory structure in pleroma/priv/static and
-    # that is is accessible by the webserver. You may need to load this file with the ssl
-    # server block commented out, run certbot to get the certificate, and then uncomment it.
-    #
-    # location ~ /\.well-known/acme-challenge {
-    #     root <path to install>/pleroma/priv/static/;
-    # }
-}
-
-# Enable SSL session caching for improved performance
-ssl_session_cache shared:ssl_session_cache:10m;
-
-server {
-    listen {{nginx_ssl_port}} ssl http2;
-    # listen [::]:{{nginx_ssl_port}} ssl ipv6only=on;
-    server_name {{nginx_server_name}};
-
-    ssl_certificate {{nginx_ssl_cert}};
-    ssl_certificate_key {{nginx_ssl_privkey}};
-    include /etc/letsencrypt/options-ssl-nginx.conf;
-    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
-
-    ssl_ecdh_curve X25519:prime256v1:secp384r1:secp521r1;
-    ssl_stapling on;
-    ssl_stapling_verify on;
-
-    add_header Strict-Transport-Security "max-age=31536000" always;
-
-    gzip_vary on;
-    gzip_proxied any;
-    gzip_comp_level 6;
-    gzip_buffers 16 8k;
-    gzip_http_version 1.1;
-    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript application/activity+json application/atom+xml;
-
-    # the nginx default is 1m, not enough for large media uploads
-    client_max_body_size 16m;
-
-    location / {
-        # if you do not want remote frontends to be able to access your Pleroma backend
-        # server, remove these lines.
-        # add_header 'Access-Control-Allow-Origin' '*' always;
-        # add_header 'Access-Control-Allow-Methods' 'POST, PUT, DELETE, GET, PATCH, OPTIONS' always;
-        # add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, Idempotency-Key' always;
-        # add_header 'Access-Control-Expose-Headers' 'Link, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining, X-Request-Id' always;
-        # if ($request_method = OPTIONS) {
-        #     return 204;
-        # }
-        # stop removing lines here.
-
-        add_header X-XSS-Protection "1; mode=block";
-        add_header X-Permitted-Cross-Domain-Policies none;
-        add_header X-Frame-Options DENY;
-        add_header X-Content-Type-Options nosniff;
-        add_header Referrer-Policy same-origin;
-        add_header X-Download-Options noopen;
-
-        # Uncomment this only after you get HTTPS working.
-        # add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
-
-        proxy_http_version 1.1;
-        proxy_set_header Upgrade $http_upgrade;
-        proxy_set_header Connection "upgrade";
-        proxy_set_header Host $http_host;
-
-        proxy_pass {{pleroma_proxy_pass}};
-
-        client_max_body_size 16m;
-    }
-
-    location /proxy {
-        proxy_cache {{pleroma_user}}-pleroma_media_cache;
-        proxy_cache_lock on;
-        proxy_ignore_client_abort on;
-        proxy_pass {{pleroma_proxy_pass}};
-    }
-}
--- a/roles/pleroma/templates/pleroma.service.j2	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# {{ansible_managed}}
-
-[Unit]
-Description=Pleroma social network
-After=network.target postgresql.service
-
-[Service]
-User={{pleroma_user}}
-WorkingDirectory=/home/{{pleroma_user}}/pleroma
-
-Environment="HOME=/home/{{pleroma_user}}"
-Environment="MIX_ENV=prod"
-Environment="PLUG_TMPDIR=/tmp/{{pleroma_user}}"
-
-ExecStart=/usr/bin/mix phx.server
-ExecReload=/bin/kill $MAINPID
-KillMode=process
-Restart=on-failure
-
-; Some security directives.
-; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.
-PrivateTmp=true
-; The /home, /root, and /run/user folders can not be accessed by this service anymore. If your Pleroma user has its home folder in one of the restricted places, or use one of these folders as its working directory, you have to set this to false.
-ProtectHome=false
-; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
-ProtectSystem=full
-; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi.
-PrivateDevices=false
-; Ensures that the service process and all its children can never gain new privileges through execve().
-NoNewPrivileges=true
-; Drops the sysadmin capability from the daemon.
-CapabilityBoundingSet=~CAP_SYS_ADMIN
-
-[Install]
-WantedBy=multi-user.target
--- a/roles/pleroma/templates/prod.secret.exs.j2	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
-use Mix.Config
-
-config :pleroma, Pleroma.Web.Endpoint,
-  url: [host: "{{pleroma_link_host}}", scheme: "{{pleroma_link_scheme}}", port: {{pleroma_link_port}}],
-  http: [port: {{pleroma_port}}, ip: {127, 0, 0, 1}],
-  secret_key_base: "{{pleroma_secret_key}}",
-  secure_cookie_flag: true
-
-config :pleroma, :http_security,
-  enabled: true,
-  sts: true,
-  referrer_policy: "same-origin"
-
-config :pleroma, :instance,
-  name: "{{pleroma_instance_name}}",
-  description: "{{pleroma_desc}}",
-  email: "{{pleroma_admin_email}}",
-  limit: {{pleroma_char_limit}},
-  registrations_open: {{pleroma_signup_open}},
-  invites_enabled: {{pleroma_invites_enabled}}
-
-config :pleroma, Pleroma.Upload,
-  filters: [Pleroma.Upload.Filter.Dedupe]
-
-config :pleroma, :media_proxy,
-  enabled: false,
-  redirect_on_failure: true
-  #base_url: "https://cache.pleroma.social"
-
-# Configure your database
-config :pleroma, Pleroma.Repo,
-  adapter: Ecto.Adapters.Postgres,
-  username: "{{pleroma_user}}",
-  password: "{{pleroma_db_passwd}}",
-  database: "{{pleroma_user}}",
-  hostname: "{{pleroma_db_host}}",
-  pool_size: 10,
-  timeout: 60000,
-  pool_timeout: 60000
--- a/roles/pleroma/templates/setup_db.psql.j2	Mon Jan 20 14:17:24 2020 -0600
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-CREATE USER {{pleroma_user}} WITH ENCRYPTED PASSWORD '{{pleroma_db_passwd}}';
-CREATE DATABASE {{pleroma_user}} WITH OWNER {{pleroma_user}};
-\c {{pleroma_user}};
---Extensions made by ecto.migrate that need superuser access
-CREATE EXTENSION IF NOT EXISTS citext;
-CREATE EXTENSION IF NOT EXISTS pg_trgm;
-CREATE EXTENSION IF NOT EXISTS "uuid-ossp";