Skip to content

Development Instructions (Ubuntu)

Kıvanç Yazan edited this page Apr 9, 2021 · 2 revisions

Installation

Get the repository.

git clone https://github.com/kyzn/PRC && cd PRC

Install dependencies.

sudo apt-get install memcached sqlite3 libssl-dev zlib1g-dev

# Get latest perl version via perlbrew
\curl -L https://install.perlbrew.pl | bash
perlbrew install -j 4 stable
perlbrew switch $(perlbrew list)
perlbrew install-cpanm

# Install CPAN deps
cpanm Carton Starman App::Sqitch DBD::SQLite DDP LWP::Protocol::https JSON::XS
carton install

Database Setup

If you have an existing prc.db, bring it to sqitch/ folder. Otherwise, build from scratch: Leave it in sqitch/ folder.

cd sqitch && sqitch deploy db:sqlite:prc.db

Secrets

You will need a couple of secrets for some functions to work.

GitHub secrets

To make GitHub authentication work, you need to set up a GitHub app for Dev purposes.

Sendgrid secrets

If you want to see emails working, you need a SendGrid API key.

Encryption and HMAC keys

These are 128 bit keys that are used to encrypt unsubscribe links in emails. If you are not going to test emails it's not required. Otherwise just put 32 as.

Example

At the root of the project, create a secrets.yml file and put your secrets there. It should look like below:

Create a secrets.yml file at the root folder of the project that looks like below. CLIENT_ID and CLIENT_SECRET are for the GitHub app. ENC_KEY and HMAC_KEY are 128 bit keys, anything goes. SG_API_KEY is sendgrid key to test sending emails, it's not required otherwise.

CLIENT_ID: ....
CLIENT_SECRET: ....
ENC_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
HMAC_KEY: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
SG_API_KEY: ....

Run

Run memcached

service memcached start

Then run the app locally:

DBIC_TRACE=1 carton exec script/prc_server.pl -r -d