2018-11-22 14:35:04 -05:00
|
|
|
Partynest
|
|
|
|
=========
|
2018-11-28 09:43:05 -05:00
|
|
|
|
2018-12-05 17:09:34 -05:00
|
|
|
[![Build Status](https://travis-ci.org/libertarian-party/partynest.svg?branch=master)](https://travis-ci.org/libertarian-party/partynest)
|
2018-12-05 17:32:07 -05:00
|
|
|
[![Coverage Status](https://coveralls.io/repos/github/libertarian-party/partynest/badge.svg?branch=master)](https://coveralls.io/github/libertarian-party/partynest?branch=master)
|
2018-12-05 17:09:34 -05:00
|
|
|
[![Maintainability](https://api.codeclimate.com/v1/badges/974d97f03895453189e1/maintainability)](https://codeclimate.com/github/libertarian-party/partynest/maintainability)
|
|
|
|
[![Inline docs](http://inch-ci.org/github/libertarian-party/partynest.svg?branch=master)](http://inch-ci.org/github/libertarian-party/partynest)
|
2018-12-05 18:04:51 -05:00
|
|
|
|
|
|
|
A web application to manage political party members and supporters.
|
2018-12-05 14:52:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Table of contents
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
* [Overview](#partynest)
|
|
|
|
* [Table of contents](#table-of-contents)
|
2018-12-05 15:31:14 -05:00
|
|
|
* [Deploy](#deploy)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Deploy
|
|
|
|
------
|
|
|
|
|
|
|
|
Tested with **Ubuntu Server 18.04 LTS**.
|
|
|
|
|
|
|
|
### System packages
|
|
|
|
|
|
|
|
* `build-essential`
|
2019-01-28 20:24:01 -05:00
|
|
|
* `gnupg2`
|
2018-12-05 15:31:14 -05:00
|
|
|
* `liblzma-dev`
|
|
|
|
* `libpq-dev`
|
|
|
|
* `patch`
|
|
|
|
* `zlib1g-dev`
|
|
|
|
|
2019-01-28 20:24:01 -05:00
|
|
|
### Ruby installation
|
|
|
|
|
2019-01-30 20:35:45 -05:00
|
|
|
Install [Ruby](https://www.ruby-lang.org) system-wide
|
|
|
|
with [RVM](https://rvm.io):
|
2019-01-28 20:24:01 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
|
|
|
|
\curl -sSL https://get.rvm.io | sudo bash -s stable
|
|
|
|
```
|
|
|
|
|
|
|
|
Replace `user` with the name of your current user:
|
|
|
|
|
|
|
|
```
|
|
|
|
sudo usermod -a -G rvm user
|
|
|
|
```
|
|
|
|
|
|
|
|
Log out from system, then log in again. Install Ruby and Bundler:
|
|
|
|
|
|
|
|
```
|
2019-04-27 07:04:36 -04:00
|
|
|
rvm install ruby-2.6.2
|
|
|
|
rvm use ruby-2.6.2
|
2019-01-28 20:24:01 -05:00
|
|
|
gem install bundler
|
|
|
|
```
|
|
|
|
|
2019-01-30 20:35:45 -05:00
|
|
|
### Node.js and Yarn installation
|
|
|
|
|
|
|
|
[Node.js](https://nodejs.org) will be installed from system packages
|
|
|
|
as [Yarn](https://yarnpkg.com) dependency:
|
|
|
|
|
|
|
|
```
|
|
|
|
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
|
|
|
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install yarn
|
|
|
|
```
|
|
|
|
|
2018-12-05 15:31:14 -05:00
|
|
|
### Steps
|
|
|
|
|
2018-12-08 08:56:09 -05:00
|
|
|
* Create directory `/opt/partynest/` writable by deploy user
|
|
|
|
* Copy file `config/master.key` to `/opt/partynest/shared/config/`
|
2018-12-05 15:31:14 -05:00
|
|
|
* Create PostgreSQL role `partynest` with password `password`
|
|
|
|
* Create PostgreSQL database `partynest_production` owned by `partynest`
|
2018-12-05 16:28:51 -05:00
|
|
|
|
2018-12-07 08:53:10 -05:00
|
|
|
### Example systemd services
|
2018-12-05 16:28:51 -05:00
|
|
|
|
2018-12-07 08:53:10 -05:00
|
|
|
Replace `user` with the name of user and `group` with the name of group
|
|
|
|
which you want an application to run as.
|
|
|
|
|
|
|
|
#### Web server
|
2018-12-05 16:28:51 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
[Unit]
|
2018-12-07 08:53:10 -05:00
|
|
|
After=syslog.target network.target
|
2018-12-05 16:28:51 -05:00
|
|
|
Description=Partynest web server
|
|
|
|
|
|
|
|
[Service]
|
2019-01-28 20:16:06 -05:00
|
|
|
ExecStart=/usr/local/rvm/bin/rvm default do bundle exec puma --environment production
|
2018-12-07 08:53:10 -05:00
|
|
|
Group=group
|
2018-12-08 23:59:03 -05:00
|
|
|
Restart=always
|
2018-12-07 08:53:10 -05:00
|
|
|
RestartSec=1
|
|
|
|
StandardOutput=syslog
|
|
|
|
StandardError=syslog
|
|
|
|
SyslogIdentifier=partynest-web
|
|
|
|
Type=simple
|
|
|
|
User=user
|
2018-12-08 08:56:09 -05:00
|
|
|
WorkingDirectory=/opt/partynest/current
|
2018-12-07 08:53:10 -05:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Job processing
|
|
|
|
|
|
|
|
```
|
|
|
|
[Unit]
|
|
|
|
After=syslog.target network.target
|
|
|
|
Description=Partynest job processing
|
|
|
|
|
|
|
|
[Service]
|
2019-01-28 20:16:06 -05:00
|
|
|
ExecStart=/usr/local/rvm/bin/rvm default do bundle exec sidekiq --environment production
|
2018-12-07 08:53:10 -05:00
|
|
|
Group=group
|
2018-12-08 23:54:05 -05:00
|
|
|
Restart=always
|
2018-12-07 08:53:10 -05:00
|
|
|
RestartSec=1
|
|
|
|
StandardOutput=syslog
|
|
|
|
StandardError=syslog
|
|
|
|
SyslogIdentifier=partynest-worker
|
2018-12-05 16:28:51 -05:00
|
|
|
Type=simple
|
|
|
|
User=user
|
2018-12-08 08:56:09 -05:00
|
|
|
WorkingDirectory=/opt/partynest/current
|
2018-12-05 16:28:51 -05:00
|
|
|
|
|
|
|
[Install]
|
|
|
|
WantedBy=multi-user.target
|
|
|
|
```
|