From 9112eda14ffa203eeca1d129d6739840f684569d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 8 Aug 2017 02:41:36 +0300 Subject: [PATCH 01/10] First attempt at installation documentation --- README.md | 74 +++++++++++++++++++++++++++++++++--- installation/pleroma.nginx | 26 +++++++++++++ installation/pleroma.service | 16 ++++++++ 3 files changed, 111 insertions(+), 5 deletions(-) create mode 100644 installation/pleroma.nginx create mode 100644 installation/pleroma.service diff --git a/README.md b/README.md index 3ccc175fa..620b3ea1d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,76 @@ # Pleroma -To start your Phoenix server: +## Installation - * Install dependencies with `mix deps.get` - * Create and migrate your database with `mix ecto.create && mix ecto.migrate` - * Start Phoenix endpoint with `mix phx.server` +### Dependencies + +* Postgresql version 9.5 or newer +* Elixir version 1.4 or newer +* NodeJS LTS + +#### Installing dependencies on Debian system +PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: `apt install postgresql-9.6`. Make sure that `postgresql-9.5` or older is not installed, for some strange reason debian allows multiple versions to coexist, what effect it has - i don't know. + +You must install elixir 1.4+ from elixir-lang.org, because Debian repos only have 1.3.x version. You will need to add apt repo to sources.list(.d) and import GPG key. Follow instructions here: https://elixir-lang.org/install.html#unix-and-unix-like (See "Ubuntu or Debian 7"). This should be valid until Debian updates elixir in their repositories. Package you want is named `elixir`, so install it using `apt install elixir` + +NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work. + +### Preparation + + * You probably want application to run as separte user - so create a new one: `adduser pleroma` + * Clone the git repository into new user's dir (clone as the user to avoid permissions errors) + * Again, as new user, install dependencies with `mix deps.get` if it asks you to install "hex" - agree to that. + +### Database preparation + + * You'll need to allow password-based authorisation for `postgres` superuser + * changing default password for superuser is probably a good idea: + * Open psql shell as postgres user: (as root) `su postgres -c psql` + * There, enter following: `ALTER USER postgres with encrypted password '';` + * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) + + * edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have 9.6 version) and change the line: + ``` + local all postgres peer + ``` + to + ``` + local all postgres md5 + ``` + * Create and migrate your database with `mix ecto.create && mix ecto.migrate`. If it gives errors, try running again, it should be ok. + * You most likely don't want having some application accessing database as superuser, so we need to create separate user for that. For now it's done manually (issue #27). + * Revert `/etc/postgresql/9.6/main/pg_hba.conf` to previous state (replace `md5` with `peer`) + * Open psql shell as postgres user: (as root) `su postgres -c psql` + * Create a new PostgreSQL user: + ```sql + \c pleroma_dev + CREATE user pleroma; + ALTER user pleroma with encrypted password ''; + GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; + GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; + ``` + * Again, change password in `config/dev.exs`, and change user too to `"pleroma"` (like like `username: "postgres"`) + +### Some additional configuration + + * You will need to let pleroma instance to know what hostname/url it's running on. + + In file `config/dev.exs`, add these lines at the end of the file: + + ```elixir + config :pleroma, Pleroma.Web.Endpoint, + url: [host: "example.tld", scheme: "https", port: 443] + ``` + + replacing `example.tld` with your (sub)domain + + * The common and convenient way for adding HTTPS is by using nginx as reverse proxy. You can look at example nginx configuration in `installation/pleroma.nginx`. If you need HTTPS certificates, you can look into letsencrypt. + + * (not tested with reboots!) You'll also want to set up Pleroma to be run as a systemd service. Example .service can be found in `installation/pleroma.service` you can put it in `/etc/systemd/system/` and run it by `service pleroma start`; You can watch logs by using `journalctl -u pleroma.service`; + + * Without systemd you can start Pleroma by starting Phoenix endpoint with `mix phx.server` + it should be available on 4000 port on localhost and proxied to 443 port by nginx. -Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment). diff --git a/installation/pleroma.nginx b/installation/pleroma.nginx new file mode 100644 index 000000000..1bdb95ab4 --- /dev/null +++ b/installation/pleroma.nginx @@ -0,0 +1,26 @@ +server { + listen 80; + server_name example.tld; + return 301 https://$server_name$request_uri; +} + +server { + listen 443; + ssl on; + ssl_session_timeout 5m; + + ssl_certificate /etc/letsencrypt/live/exmaple.tld/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem; + + ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; + ssl_prefer_server_ciphers on; + + server_name example.tld; + + location / { + proxy_pass http://localhost:4000; + } + include snippets/well-known.conf; + +} \ No newline at end of file diff --git a/installation/pleroma.service b/installation/pleroma.service new file mode 100644 index 000000000..fe314ed2b --- /dev/null +++ b/installation/pleroma.service @@ -0,0 +1,16 @@ +[Unit] +Description=Pleroma social network +After=network.target postgresql.service + +[Service] +User=pleroma +WorkingDirectory=/home/pleroma/pleroma +Environment="HOME=/home/pleroma" +ExecStart=/usr/local/bin/mix phx.server +ExecReload=/bin/kill $MAINPID +KillMode=process +Restart=on-failure + +[Install] +WantedBy=multi-user.target +Alias=pleroma.service From da3e9e4e7e93a9a72f71b132915ad905e09d2f4b Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 15 Aug 2017 23:50:23 +0300 Subject: [PATCH 02/10] update --- README.md | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 620b3ea1d..d0aeaebd0 100644 --- a/README.md +++ b/README.md @@ -7,26 +7,29 @@ * Postgresql version 9.5 or newer * Elixir version 1.4 or newer * NodeJS LTS +* Build-essential tools #### Installing dependencies on Debian system -PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: `apt install postgresql-9.6`. Make sure that `postgresql-9.5` or older is not installed, for some strange reason debian allows multiple versions to coexist, what effect it has - i don't know. +PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: `apt install postgresql-9.6`. Make sure that older versions are not installed, debian allows multiple versions to coexist but still runs only one version. You must install elixir 1.4+ from elixir-lang.org, because Debian repos only have 1.3.x version. You will need to add apt repo to sources.list(.d) and import GPG key. Follow instructions here: https://elixir-lang.org/install.html#unix-and-unix-like (See "Ubuntu or Debian 7"). This should be valid until Debian updates elixir in their repositories. Package you want is named `elixir`, so install it using `apt install elixir` +Elixir will also require `make` and probably other related software for building dependencies - in case you don't have them, get them via `apt install build-essential` + NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work. ### Preparation - * You probably want application to run as separte user - so create a new one: `adduser pleroma` - * Clone the git repository into new user's dir (clone as the user to avoid permissions errors) + * You probably want application to run as separte user - so create a new one: `adduser pleroma`, you can login as it via `su pleroma` + * Clone the git repository into new user's dir (clone as the pleroma user to avoid permissions errors) * Again, as new user, install dependencies with `mix deps.get` if it asks you to install "hex" - agree to that. ### Database preparation * You'll need to allow password-based authorisation for `postgres` superuser * changing default password for superuser is probably a good idea: - * Open psql shell as postgres user: (as root) `su postgres -c psql` - * There, enter following: `ALTER USER postgres with encrypted password '';` + * Open psql shell as postgres user - while being root run `su postgres -c psql` + * There, enter following: `ALTER USER postgres with encrypted password '';` - where is just any string, no need to manually encrypt it, postgres will encrypt it automatically for you. * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) * edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have 9.6 version) and change the line: @@ -37,9 +40,10 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian ``` local all postgres md5 ``` - * Create and migrate your database with `mix ecto.create && mix ecto.migrate`. If it gives errors, try running again, it should be ok. - * You most likely don't want having some application accessing database as superuser, so we need to create separate user for that. For now it's done manually (issue #27). - * Revert `/etc/postgresql/9.6/main/pg_hba.conf` to previous state (replace `md5` with `peer`) + don't forget to revert it in the later step so you won't have to enter password when accessing psql console. + * Create and update your database with `mix ecto.create && mix ecto.migrate`. If it gives errors, try running again, this is a known issue. + * Undo changes you made in `/etc/postgresql/9.6/main/pg_hba.conf` (replace `md5` with `peer`) + * You most likely don't want having some application accessing database as superuser, so you need to create separate user for that. Right now it must be done manually (issue #27). * Open psql shell as postgres user: (as root) `su postgres -c psql` * Create a new PostgreSQL user: ```sql @@ -49,7 +53,7 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; ``` - * Again, change password in `config/dev.exs`, and change user too to `"pleroma"` (like like `username: "postgres"`) + * Again, change password in `config/dev.exs`, and change user to `"pleroma"` (line like `username: "postgres"`) ### Some additional configuration @@ -64,13 +68,20 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian replacing `example.tld` with your (sub)domain - * The common and convenient way for adding HTTPS is by using nginx as reverse proxy. You can look at example nginx configuration in `installation/pleroma.nginx`. If you need HTTPS certificates, you can look into letsencrypt. + * The common and convenient way for adding HTTPS is by using nginx as reverse proxy. You can look at example nginx configuration in `installation/pleroma.nginx`. If you need TLS/SSL certificates for HTTPS, you can look get some for free with letsencrypt: https://letsencrypt.org/ + On debian you can use `certbot` package and command to manage letsencrypt certificates. - * (not tested with reboots!) You'll also want to set up Pleroma to be run as a systemd service. Example .service can be found in `installation/pleroma.service` you can put it in `/etc/systemd/system/` and run it by `service pleroma start`; You can watch logs by using `journalctl -u pleroma.service`; + * (not tested with reboots yet!) You'll also want to set up Pleroma to be run as a systemd service. Example .service can be found in `installation/pleroma.service` you can put it in `/etc/systemd/system/`. + Start pleroma by running `service pleroma start` + Logs can be watched by using `journalctl -fu pleroma.service` * Without systemd you can start Pleroma by starting Phoenix endpoint with `mix phx.server` - it should be available on 4000 port on localhost and proxied to 443 port by nginx. +In any case, it should be available on 4000 port on localhost and proxied to 443 port by nginx. + + + +# Phoenix info Ready to run in production? Please [check our deployment guides](http://www.phoenixframework.org/docs/deployment). From 7b2bded06f8602707ab0f76d1898998943d2ea5c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 15 Aug 2017 23:51:29 +0300 Subject: [PATCH 03/10] formatting --- README.html | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 README.html diff --git a/README.html b/README.html new file mode 100644 index 000000000..f62ab585a --- /dev/null +++ b/README.html @@ -0,0 +1,112 @@ + + + + + + +README.html + + + + + +

Pleroma

+ +

Installation

+ +

Dependencies

+ +
    +
  • Postgresql version 9.5 or newer
  • +
  • Elixir version 1.4 or newer
  • +
  • NodeJS LTS
  • +
+ +

Installing dependencies on Debian system

+ +

PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: apt install postgresql-9.6. Make sure that postgresql-9.5 or older is not installed, for some strange reason debian allows multiple versions to coexist, what effect it has - i don't know.

+ +

You must install elixir 1.4+ from elixir-lang.org, because Debian repos only have 1.3.x version. You will need to add apt repo to sources.list(.d) and import GPG key. Follow instructions here: https://elixir-lang.org/install.html#unix-and-unix-like (See "Ubuntu or Debian 7"). This should be valid until Debian updates elixir in their repositories. Package you want is named elixir, so install it using apt install elixir

+ +

NodeJS is available as nodejs package on debian. apt install nodejs. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work.

+ +

Preparation

+ +
    +
  • You probably want application to run as separte user - so create a new one: adduser pleroma
  • +
  • Clone the git repository into new user's dir (clone as the user to avoid permissions errors)
  • +
  • Again, as new user, install dependencies with mix deps.get if it asks you to install "hex" - agree to that.
  • +
+ +

Database preparation

+ +
    +
  • You'll need to allow password-based authorisation for postgres superuser

    + +
      +
    • changing default password for superuser is probably a good idea:

      + +
        +
      • Open psql shell as postgres user: (as root) su postgres -c psql
      • +
      • There, enter following: ALTER USER postgres with encrypted password '<YOUR SECURE PASSWORD>';
      • +
      • Replace password in file config/dev.exs with password you supplied in previous step (look for line like password: "postgres")
      • +
    • +
    • edit /etc/postgresql/9.6/main/pg_hba.conf (Assuming you have 9.6 version) and change the line: + +local all postgres peer + +to + +local all postgres md5 +

    • +
  • +
  • Create and migrate your database with mix ecto.create && mix ecto.migrate. If it gives errors, try running again, it should be ok.
  • +
  • You most likely don't want having some application accessing database as superuser, so we need to create separate user for that. For now it's done manually (issue #27). +
      +
    • Revert /etc/postgresql/9.6/main/pg_hba.conf to previous state (replace md5 with peer)
    • +
    • Open psql shell as postgres user: (as root) su postgres -c psql
    • +
    • Create a new PostgreSQL user: +sql +\c pleroma_dev +CREATE user pleroma; +ALTER user pleroma with encrypted password '<your password>'; +GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; +GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; +
    • +
    • Again, change password in config/dev.exs, and change user too to "pleroma" (like like username: "postgres")
    • +
  • +
+ +

Some additional configuration

+ +
    +
  • You will need to let pleroma instance to know what hostname/url it's running on.

    + +

    In file config/dev.exs, add these lines at the end of the file:

    + +

    elixir +config :pleroma, Pleroma.Web.Endpoint, +url: [host: "example.tld", scheme: "https", port: 443] +

    + +

    replacing example.tld with your (sub)domain

  • +
  • Start Phoenix endpoint with mix phx.server

  • +
+ +

Now you can visit localhost:4000 from your browser.

+ +

Ready to run in production? Please check our deployment guides.

+ +

Learn more

+ +
    +
  • Official website: http://www.phoenixframework.org/
  • +
  • Guides: http://phoenixframework.org/docs/overview
  • +
  • Docs: https://hexdocs.pm/phoenix
  • +
  • Mailing list: http://groups.google.com/group/phoenix-talk
  • +
  • Source: https://github.com/phoenixframework/phoenix
  • +
+ + + From c6941676ba9546e8ec451f5f289122a26aa7a070 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 15 Aug 2017 23:52:29 +0300 Subject: [PATCH 04/10] Revert "formatting" This reverts commit 7b2bded06f8602707ab0f76d1898998943d2ea5c. --- README.html | 112 ---------------------------------------------------- README.md | 2 + 2 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 README.html diff --git a/README.html b/README.html deleted file mode 100644 index f62ab585a..000000000 --- a/README.html +++ /dev/null @@ -1,112 +0,0 @@ - - - - - - -README.html - - - - - -

Pleroma

- -

Installation

- -

Dependencies

- -
    -
  • Postgresql version 9.5 or newer
  • -
  • Elixir version 1.4 or newer
  • -
  • NodeJS LTS
  • -
- -

Installing dependencies on Debian system

- -

PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: apt install postgresql-9.6. Make sure that postgresql-9.5 or older is not installed, for some strange reason debian allows multiple versions to coexist, what effect it has - i don't know.

- -

You must install elixir 1.4+ from elixir-lang.org, because Debian repos only have 1.3.x version. You will need to add apt repo to sources.list(.d) and import GPG key. Follow instructions here: https://elixir-lang.org/install.html#unix-and-unix-like (See "Ubuntu or Debian 7"). This should be valid until Debian updates elixir in their repositories. Package you want is named elixir, so install it using apt install elixir

- -

NodeJS is available as nodejs package on debian. apt install nodejs. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work.

- -

Preparation

- -
    -
  • You probably want application to run as separte user - so create a new one: adduser pleroma
  • -
  • Clone the git repository into new user's dir (clone as the user to avoid permissions errors)
  • -
  • Again, as new user, install dependencies with mix deps.get if it asks you to install "hex" - agree to that.
  • -
- -

Database preparation

- -
    -
  • You'll need to allow password-based authorisation for postgres superuser

    - -
      -
    • changing default password for superuser is probably a good idea:

      - -
        -
      • Open psql shell as postgres user: (as root) su postgres -c psql
      • -
      • There, enter following: ALTER USER postgres with encrypted password '<YOUR SECURE PASSWORD>';
      • -
      • Replace password in file config/dev.exs with password you supplied in previous step (look for line like password: "postgres")
      • -
    • -
    • edit /etc/postgresql/9.6/main/pg_hba.conf (Assuming you have 9.6 version) and change the line: - -local all postgres peer - -to - -local all postgres md5 -

    • -
  • -
  • Create and migrate your database with mix ecto.create && mix ecto.migrate. If it gives errors, try running again, it should be ok.
  • -
  • You most likely don't want having some application accessing database as superuser, so we need to create separate user for that. For now it's done manually (issue #27). -
      -
    • Revert /etc/postgresql/9.6/main/pg_hba.conf to previous state (replace md5 with peer)
    • -
    • Open psql shell as postgres user: (as root) su postgres -c psql
    • -
    • Create a new PostgreSQL user: -sql -\c pleroma_dev -CREATE user pleroma; -ALTER user pleroma with encrypted password '<your password>'; -GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; -GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; -
    • -
    • Again, change password in config/dev.exs, and change user too to "pleroma" (like like username: "postgres")
    • -
  • -
- -

Some additional configuration

- -
    -
  • You will need to let pleroma instance to know what hostname/url it's running on.

    - -

    In file config/dev.exs, add these lines at the end of the file:

    - -

    elixir -config :pleroma, Pleroma.Web.Endpoint, -url: [host: "example.tld", scheme: "https", port: 443] -

    - -

    replacing example.tld with your (sub)domain

  • -
  • Start Phoenix endpoint with mix phx.server

  • -
- -

Now you can visit localhost:4000 from your browser.

- -

Ready to run in production? Please check our deployment guides.

- -

Learn more

- -
    -
  • Official website: http://www.phoenixframework.org/
  • -
  • Guides: http://phoenixframework.org/docs/overview
  • -
  • Docs: https://hexdocs.pm/phoenix
  • -
  • Mailing list: http://groups.google.com/group/phoenix-talk
  • -
  • Source: https://github.com/phoenixframework/phoenix
  • -
- - - diff --git a/README.md b/README.md index d0aeaebd0..72a6fa835 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian * You most likely don't want having some application accessing database as superuser, so you need to create separate user for that. Right now it must be done manually (issue #27). * Open psql shell as postgres user: (as root) `su postgres -c psql` * Create a new PostgreSQL user: + ```sql \c pleroma_dev CREATE user pleroma; @@ -53,6 +54,7 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; ``` + * Again, change password in `config/dev.exs`, and change user to `"pleroma"` (line like `username: "postgres"`) ### Some additional configuration From 3e2f6895c36d35182c3ab834756a8f1ffa1a9530 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 15 Aug 2017 23:54:15 +0300 Subject: [PATCH 05/10] formatting --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 72a6fa835..d849b5812 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,17 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) * edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have 9.6 version) and change the line: + ``` local all postgres peer ``` + to + ``` local all postgres md5 ``` + don't forget to revert it in the later step so you won't have to enter password when accessing psql console. * Create and update your database with `mix ecto.create && mix ecto.migrate`. If it gives errors, try running again, this is a known issue. * Undo changes you made in `/etc/postgresql/9.6/main/pg_hba.conf` (replace `md5` with `peer`) From 47a72c04f92477aff4954d208a102bddcb69f8ba Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 16 Aug 2017 00:16:55 +0300 Subject: [PATCH 06/10] more fixes --- README.md | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d849b5812..5f6e91d06 100644 --- a/README.md +++ b/README.md @@ -4,19 +4,19 @@ ### Dependencies -* Postgresql version 9.5 or newer +* Postgresql version 9.6 or newer * Elixir version 1.4 or newer * NodeJS LTS * Build-essential tools #### Installing dependencies on Debian system -PostgreSQL 9.6 should be available on debian stable (Jessie) from "main" area. Install it using apt: `apt install postgresql-9.6`. Make sure that older versions are not installed, debian allows multiple versions to coexist but still runs only one version. +PostgreSQL 9.6 should be available on Debian stable (Jessie) from "main" area. Install it using apt: `apt install postgresql-9.6`. Make sure that older versions are not installed since Debian allows multiple versions to coexist but still runs only one version. You must install elixir 1.4+ from elixir-lang.org, because Debian repos only have 1.3.x version. You will need to add apt repo to sources.list(.d) and import GPG key. Follow instructions here: https://elixir-lang.org/install.html#unix-and-unix-like (See "Ubuntu or Debian 7"). This should be valid until Debian updates elixir in their repositories. Package you want is named `elixir`, so install it using `apt install elixir` Elixir will also require `make` and probably other related software for building dependencies - in case you don't have them, get them via `apt install build-essential` -NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work. +NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian stable has 4.8.x version. If that does not work, use nodesource's repo https://github.com/nodesource/distributions#deb - version 5.x confirmed to work. ### Preparation @@ -24,15 +24,21 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian * Clone the git repository into new user's dir (clone as the pleroma user to avoid permissions errors) * Again, as new user, install dependencies with `mix deps.get` if it asks you to install "hex" - agree to that. -### Database preparation +### Database setup * You'll need to allow password-based authorisation for `postgres` superuser - * changing default password for superuser is probably a good idea: + * Changing default password for superuser is probably a good idea: * Open psql shell as postgres user - while being root run `su postgres -c psql` - * There, enter following: `ALTER USER postgres with encrypted password '';` - where is just any string, no need to manually encrypt it, postgres will encrypt it automatically for you. + * There, enter following: + + ```sql + ALTER USER postgres with encrypted password ''; + ``` + + where is any string, no need to manually encrypt it - postgres will encrypt it automatically for you. * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) - * edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have 9.6 version) and change the line: + * Edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have the 9.6 version) and change the line: ``` local all postgres peer @@ -47,7 +53,7 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian don't forget to revert it in the later step so you won't have to enter password when accessing psql console. * Create and update your database with `mix ecto.create && mix ecto.migrate`. If it gives errors, try running again, this is a known issue. * Undo changes you made in `/etc/postgresql/9.6/main/pg_hba.conf` (replace `md5` with `peer`) - * You most likely don't want having some application accessing database as superuser, so you need to create separate user for that. Right now it must be done manually (issue #27). + * You most likely don't want having some application accessing database as a superuser, so you should create separate user for Pleroma. Right now it must be done manually (issue #27). * Open psql shell as postgres user: (as root) `su postgres -c psql` * Create a new PostgreSQL user: @@ -74,18 +80,21 @@ NodeJS is available as `nodejs` package on debian. `apt install nodejs`. Debian replacing `example.tld` with your (sub)domain - * The common and convenient way for adding HTTPS is by using nginx as reverse proxy. You can look at example nginx configuration in `installation/pleroma.nginx`. If you need TLS/SSL certificates for HTTPS, you can look get some for free with letsencrypt: https://letsencrypt.org/ - On debian you can use `certbot` package and command to manage letsencrypt certificates. + * The common and convenient way for adding HTTPS is by using Nginx as a reverse proxy. You can look at example Nginx configuration in `installation/pleroma.nginx`. If you need TLS/SSL certificates for HTTPS, you can look get some for free with letsencrypt: https://letsencrypt.org/ + On Debian you can use `certbot` package and command to manage letsencrypt certificates. - * (not tested with reboots yet!) You'll also want to set up Pleroma to be run as a systemd service. Example .service can be found in `installation/pleroma.service` you can put it in `/etc/systemd/system/`. - Start pleroma by running `service pleroma start` - Logs can be watched by using `journalctl -fu pleroma.service` + * [Not tested with system reboot yet!] You'll also want to set up Pleroma to be run as a systemd service. Example .service file can be found in `installation/pleroma.service` you can put it in `/etc/systemd/system/`. - * Without systemd you can start Pleroma by starting Phoenix endpoint with `mix phx.server` +## Running -In any case, it should be available on 4000 port on localhost and proxied to 443 port by nginx. +By default, it listens on port 4000 (TCP), so you can access it on http://localhost:4000/ (if you it on same machine). In case of an error it will restart automatically. +### As systemd service (with provided .service file) +Running `service pleroma start` +Logs can be watched by using `journalctl -fu pleroma.service` +### Standalone/run by other means +Run `mix phx.server` in repository's root, it will output log into stdout/stderr # Phoenix info From d1863d6db720208f0bf07229b8e1d89890deaac5 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 16 Aug 2017 00:19:08 +0300 Subject: [PATCH 07/10] these are not html tags, silly markdown --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 5f6e91d06..e91a7c3cc 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian * There, enter following: ```sql - ALTER USER postgres with encrypted password ''; + ALTER USER postgres with encrypted password '[PASSWORD]'; ``` - where is any string, no need to manually encrypt it - postgres will encrypt it automatically for you. + where [PASSWORD] is any string, no need to manually encrypt it - postgres will encrypt it automatically for you. * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) * Edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have the 9.6 version) and change the line: @@ -60,7 +60,7 @@ NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian ```sql \c pleroma_dev CREATE user pleroma; - ALTER user pleroma with encrypted password ''; + ALTER user pleroma with encrypted password '[your password]'; GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; ``` From bd40613d7b00d2de4e0332b04ac799463828b9bf Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 16 Aug 2017 00:20:02 +0300 Subject: [PATCH 08/10] formatting --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e91a7c3cc..095864de3 100644 --- a/README.md +++ b/README.md @@ -32,10 +32,10 @@ NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian * There, enter following: ```sql - ALTER USER postgres with encrypted password '[PASSWORD]'; + ALTER USER postgres with encrypted password ''; ``` - where [PASSWORD] is any string, no need to manually encrypt it - postgres will encrypt it automatically for you. + where `` is any string, no need to manually encrypt it - postgres will encrypt it automatically for you. * Replace password in file `config/dev.exs` with password you supplied in previous step (look for line like `password: "postgres"`) * Edit `/etc/postgresql/9.6/main/pg_hba.conf` (Assuming you have the 9.6 version) and change the line: @@ -60,7 +60,7 @@ NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian ```sql \c pleroma_dev CREATE user pleroma; - ALTER user pleroma with encrypted password '[your password]'; + ALTER user pleroma with encrypted password ''; GRANT ALL ON ALL tables IN SCHEMA public TO pleroma; GRANT ALL ON ALL sequences IN SCHEMA public TO pleroma; ``` From 0391981b4d16deda0fc80dea4c97c675d07d3aec Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 16 Aug 2017 00:21:38 +0300 Subject: [PATCH 09/10] fix --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 095864de3..930d0647c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ NodeJS is available as `nodejs` package on Debian. `apt install nodejs`. Debian ## Running -By default, it listens on port 4000 (TCP), so you can access it on http://localhost:4000/ (if you it on same machine). In case of an error it will restart automatically. +By default, it listens on port 4000 (TCP), so you can access it on http://localhost:4000/ (if you are on the same machine). In case of an error it will restart automatically. ### As systemd service (with provided .service file) Running `service pleroma start` From a6e89ae6a389c23288ef6abc9459da35002e0fac Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 16 Aug 2017 00:25:26 +0300 Subject: [PATCH 10/10] disable sslv3 --- installation/pleroma.nginx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installation/pleroma.nginx b/installation/pleroma.nginx index 1bdb95ab4..1a6e1d56f 100644 --- a/installation/pleroma.nginx +++ b/installation/pleroma.nginx @@ -12,7 +12,7 @@ server { ssl_certificate /etc/letsencrypt/live/exmaple.tld/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.tld/privkey.pem; - ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; ssl_prefer_server_ciphers on;