Phlogiston/Installation

Operating System
These instructions assume installation of Phlogiston on a Debian GNU/Linux Stretch (9.5) system.

In Labs, to enable the bigger hard drive, go to https://horizon.wikimedia.org/project/puppet/ and activate the puppet "profile::labs::lvm::srv*

Move Postgres's working directories to the new folder.

R
Install R repository to get the newest version (from DigitalOcean instructions)

A shell account for Phlogiston
This account is used to run Phlogiston, store data, and publish for the webserver. By convention it's called. Create it and apply whatever login rules, ssh, configuration, and security as is appropriate.

Set up Python
As user :

Set up R
As phlogiston, type  to enter R command line. In R,

If prompted where to install, Install locally.

A Postgres account for Phlogiston
The local account must have access to a PostGreSQL database for data storage and reporting. As root:

Superuser access is required to because load_tables.sql installs the intarray postgresql extension. This also allows the script to create or reset its own data tables. Probably don't do this on a shared server.

Access to Phlogiston directories for postgresql
The Phlogiston scripts run some commands on the postgresql server, which runs under the postgres user, which needs to have access to phlogiston directories via the phlogiston group.

Install Phlogiston
Get the phlogiston code by cloning it from github. As the phlogiston user:

Configure Nginx
Configure Nginx to publish from the phlogiston html output directory. Create the following file as :

server { server_name localhost; listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /home/phlogiston/html; index index.html index.htm; ssi on; location / { autoindex on; # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; # Uncomment to enable naxsi on this location # include /etc/nginx/naxsi.rules }       }

And run these commands to configure Nginx to use it

Set up the reports home page
And edit index.html to reflect the scopes being reported.

First run
where xxx is a correctly configured scope. Validate the results.

Automate daily reports

 * 1) Run a complete reconstruction for all scopes:
 * 2) where xxx and yyy are reporting scopes.  Append as many   as needed.
 * 3) Create a cron job for the phlogiston user, of the form
 * 4) This runs daily at 4:15 am UTC.  Set this to be right after the dump is generated from Phabricator, and to run as often as the dump is updated.  (Phlogiston can take hours to run, so anything more than daily may not be practical without optimization.)
 * 5) The file   can be inspected for status.
 * 6) In particular,   will show one line per scope per reconstruction and/or report.
 * 1) The file   can be inspected for status.
 * 2) In particular,   will show one line per scope per reconstruction and/or report.

How to use on other Phabricator instances besides Wikimedia Foundation
Untested:

1) set up a dump script on Phabricator, like this one, to generate dumps like this one.

2) Customize  to point to the new dump file.