-
Notifications
You must be signed in to change notification settings - Fork 0
Installation
[TOC]
If you want to host your own instance of fastcry.pt or simply want to contribute/develop the fastcry.pt sources, you need follow these steps to get a working environment
You can always get the latest sources from this Bitbucket project. If you want to contribute to the project, please fork the sources and clone your own fork.
#!bash
$ git clone git@bitbucket.org:wneessen/fastcry.pt.git
Check the Requirements page on what software is needed to run fastcry.pt.
fastcry.pt stores the encrypted files in a file system structure. You need to create this directory first and the fastcry.pt process needs to have write permissions in it.
#!bash
mkdir files
You can configure the files path in the conf/FastCrypt.conf file:
#!perl
## File/Path settings
filePath => 'files',
fastcry.pt also needs some secret settings. These are not synced in the Git repository, so you need to create this file on your own. Currently it only holds the Mojolicious session secret, but other settings might follow.
#!bash
echo "{ sessionSecret => 'YOUR SECRET HERE', }" >conf/FastCryptSecret.conf
If you are developing fastcry.pt, there is a neat option for logging in Mojolicious. This requires a log directory.
#!bash
mkdir log
fastcry.pt ships with a set of shell scripts, that make it easy to start the development server. Just run it by:
#!bash
cd bin && ./log.sh
There will be no log file before you started the fastcry.pt instance and sent a request to it. So do this first, otherwise the script will give an error.
To start the service in development mode, there is also a handy script in the bin/ directory, that will start the Mojo service in development. Advantage of the DEV-mode is, that it monitors changes in the lib/, conf/ and templates/ directories and automagically restarts the service if any file changes. Just use the following command to start the service:
#!bash
cd bin && ./server.sh
The development instance (via the server.sh script) will listen on http://0.0.0.0:5313. By default the config setting
#!perl
## Session settings
sessionSecureFlag => 1,
is set. This means that the session cookie holds the "secure" flag, which will disallow any transmission of the cookie via a non-secure connection. If you want to actively develop fastcry.pt you either need to change this setting to 0 or put a https-enabled proxy in front of it (i. e. nginx).
To start the service in production, you shouldn't use the server.sh script, but instead use hypnotoad to start the mojo service.
#!bash
cd <path to fastcry.pt>
env MOJO_REVERSE_PROXY=1 hypnotoad script/fast_crypt
The MOJO_REVERSE_PROXY parameter will make sure, that X-Forwarded parameters of the proxy in front of hypnotoad will be handled correctly by the fastcry.pt. If not set, URLs might look like this: http://localhost:8080/.
I highly recommend to not run a production instance of fastcry.pt without a proxy in front of it. Proxies like nginx are easy to set up, are stable in handling lots of traffic and can also take care of the SSL offloading.
Here is a sample nginx config for fastcry.pt
#!nginx
server {
add_header Alternate-Protocol "443:npn-spdy/3.1";
add_header Strict-Transport-Security "max-age=315360000; includeSubdomains";
error_log <logdir>/fastcry.pt-error.log warn;
listen 443 ssl;
server_name <your hostname>;
ssl_certificate <path to certdir>/fastcry.pt.crt;
ssl_certificate_key <path to certdir>/fastcry.pt.key;
location / {
proxy_pass http://<hostname of hypnotoad instance>:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location ~ ^/favicon\.ico$ {
root <path to fastcry.pt>/public;
log_not_found off;
access_log off;
expires max;
}
location ~ ^/(css|fonts|foundation|js)/ {
root <path to fastcry.pt>/public;
log_not_found off;
access_log off;
expires max;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ ^/(conf|log|lib|script|t|template|bin|files|client)/ {
deny all;
}
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}
}