Skip to content

Commit

Permalink
INSTALL.md
Browse files Browse the repository at this point in the history
  • Loading branch information
vanyabrovary committed Aug 8, 2017
1 parent 698c201 commit f96fa1c
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 16 deletions.
107 changes: 107 additions & 0 deletions INSTALL.md
@@ -0,0 +1,107 @@
# Installing WebBoard

This is the installation documentation for WebBoard

### Requirements

* Unix, Linux, Mac, Mac Server, Windows systems as long as perl is available.
* Perl > 5.20
* Apache 2.4 / mod_perl 2.0.9
* Nginx
* MariaDB > 10.0 or MySQL

### Step 1. Dependencies installation

#### Step 1.1. Installing modules from CPAN.

<pre>
DBI
Template
Moose
Email::Valid;
reCAPTCHA
String::Clean::XSS
Config::Tiny
Geo::IP
Mojolicious
Captcha::reCAPTCHA
Plack::Handler::Apache2
</pre>

#### Step 1.2. Installing modules using apt-get.

<pre>
apt-get install libapache2-mod-perl2 apache2 apache2-utils nginx mariadb-server-10.1
</pre>

### Step 2. Installing project libs

#### Step 2.1. Get last version

<pre>
cd /var/www
git clone https://github.com/vanyabrovary/WebBoard.git
</pre>

#### Step 2.2. MySQL database import

<pre>
mysql -e 'CREATE DATABASE web_board /*!40100 DEFAULT CHARACTER SET utf8 */'
mysql -e "GRANT ALL ON web_board.* TO 'web_board' IDENTIFIED BY 'web_board'"
mysql shop < /var/www/WebBoard/etc/conf/web_board.sql
</pre>

#### Step 2.3. Configure apache.

_Change config values for apache2.conf:_

<pre>
vim /etc/apache2/apache2.conf
</pre>

_Add the following lines to apache2.conf:_

<pre>
Include /var/www/WebBoard/etc/conf/apache.conf
</pre>

#### Step 2.4. Configure nginx.

_Change config values for nginx.conf:_

<pre>
vim /etc/nginx/nginx.conf
</pre>

_Add the following line to nginx.conf:_

<pre>
include /var/www/WebBoard/etc/conf/nginx.conf;
</pre>

#### Step 2.5. Change WebBoard config file.

_Edit this file in order to configure your project settings_

<pre>
vim /var/www/WebBoard/etc/my.ini
</pre>

### Step 3. Restarting services.

* /etc/init.d/apache2 restart
* /etc/init.d/nginx restart

### Debugging during installation

#### Error logs.

<pre>
tail -f /var/www/WebBoard/log/error.log
</pre>

#### Debug logs.

<pre>
tail -f /var/www/WebBoard/log/production.log
</pre>
24 changes: 12 additions & 12 deletions etc/conf/apache.itst.ssh.in.ua.conf → etc/conf/apache.conf
@@ -1,34 +1,34 @@
## mod_perl ##
<VirtualHost *:8080>
ServerName itst.ssh.in.ua
DocumentRoot /var/www/itst.ssh.in.ua
ServerName WebBoard
DocumentRoot /var/www/WebBoard
PerlOptions +Parent
PerlOptions -ParseHeaders
Options +FollowSymLinks
PerlSwitches -Mlib=/var/www/itst.ssh.in.ua/lib
PerlSwitches -Mlib=/var/www/WebBoard/lib
PerlModule Apache::DBI
<Perl>
$ENV{MOJO_TEMPLATE_CACHE} = 0;
$ENV{PLACK_ENV} = 'production';
$ENV{MOJO_MODE} = 'production';
$ENV{MOJO_HOME} = '/var/www/itst.ssh.in.ua';
$ENV{MOJO_HOME} = '/var/www/WebBoard';
</Perl>
<Location />
SetHandler perl-script
PerlResponseHandler Plack::Handler::Apache2
PerlSetVar psgi_app /var/www/itst.ssh.in.ua/index.cgi
PerlSetVar psgi_app /var/www/WebBoard/index.cgi
</Location>
ErrorLog /var/www/itst.ssh.in.ua/log/error.log
ServerAdmin root@itst.ssh.in.ua
ErrorLog /var/www/WebBoard/log/error.log
ServerAdmin root@WebBoard
</VirtualHost>

## CGI ##

#<VirtualHost *:8080>
# ServerName itst.ssh.in.ua
# DocumentRoot /var/www/itst.ssh.in.ua
# ServerAdmin root@itst.ssh.in.ua
# <Directory /var/www/itst.ssh.in.ua>
# ServerName WebBoard
# DocumentRoot /var/www/WebBoard
# ServerAdmin root@WebBoard
# <Directory /var/www/WebBoard>
# Options +ExecCGI
# AddHandler cgi-script .cgi
# Options +FollowSymLinks
Expand All @@ -40,5 +40,5 @@
# RewriteRule ^$ /index.cgi [L]
# AllowOverride All
# </Directory>
# ErrorLog /var/www/itst.ssh.in.ua/log/error.log
# ErrorLog /var/www/WebBoard/log/error.log
#</VirtualHost>
2 changes: 1 addition & 1 deletion etc/conf/nginx.itst.ssh.in.ua.conf → etc/conf/nginx.conf
@@ -1,7 +1,7 @@
server
{
listen 91.0.0.2:80;
server_name itst.ssh.in.ua;
server_name WebBoard;

location / {
proxy_pass http://127.0.0.1:8080/;
Expand Down
3 changes: 2 additions & 1 deletion lib/Lib.pm
Expand Up @@ -3,6 +3,8 @@ package Lib;
use warnings;
use strict;

use Geo::IP;

use reCAPTCHA qw/ GetCaptchaHtml /;

sub new { bless( {}, shift ) }
Expand All @@ -12,7 +14,6 @@ sub get_captcha_html {
}

sub user_country {
use Geo::IP;
my $gi = Geo::IP->open('/usr/share/GeoIP/GeoIP.dat') or return '';
return $gi->country_code_by_addr( $ENV{REMOTE_ADDR} );
}
Expand Down
2 changes: 0 additions & 2 deletions lib/Valid.pm
Expand Up @@ -3,8 +3,6 @@ package Valid;
use warnings;
use strict;

use Carp;

sub form {
my $self = shift;
my $name = shift;
Expand Down

0 comments on commit f96fa1c

Please sign in to comment.