-
Notifications
You must be signed in to change notification settings - Fork 4
Installation
NOTE: This configuration is provisional, we are improving installation guides. If you have some suggestions, please tell us :)
You can install Kip in different ways. The easiest way is with docker-compose
, but you can install it in a custom server.
To run Kip with docker follow it's installation guide to get docker-engine
and docker-compose
. After install docker tools, run next commands in a terminal:
# Clone the project
git clone https://github.com/Angelmmiguel/kip.git
cd kip
# Create secrets file. You can skip this command if you create config/secrets.env
# with the following format:
#
# # Content of config/secrets.env
# SECRET_KEY_BASE=$string
# # Where $string is an alphanumeric lowercase random string with 128 characters.
#
echo "SECRET_KEY_BASE=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-z0-9' | fold -w 128 | head -n 1)" >> config/secrets.env
# Run with docker compose
docker-compose up
Go to http://localhost:3000
and start to write your articles :).
If you stop the services with docker-compose stop
you can start them after with docker-compose start
and restore all articles.
To update the web go to the kip
folder and run the following command:
./scripts/docker_update.sh
Before you begin this installation, you should have a regular, non-root user with sudo
privileges configured on your Ubuntu Server. I select the 14.04
Ubuntu server version and create the user kip
with sudo privileges.
NGINX package is in default repositories of Ubuntu, so we can install it using apt
. In addition we will install git
and nodejs
because we need in other steps.
sudo apt-get update
sudo apt-get install -y nginx git nodejs
# Start our NGINX server
sudo service nginx start
To test NGINX, open http://your_ip
in your browser. You must see the following page:
![nginx](https://cloud.githubusercontent.com/assets/4056725/14586417/c1c5e190-0497-11e6-9326-b00270aa43f6.png)
To store the data, Kip
uses MongoDB, so let's install it. The following commands are described in MongoDB installation guide.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
sudo apt-get update
sudo apt-get install -y mongodb-org
# Start it
sudo service mongod start
Now, we are going to install Ruby 2.3.0
through RVM package manager:
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash
The next step is to load RVM in your current terminal. Remember to replace kip
with your current user.
source /home/kip/.rvm/scripts/rvm
Install Ruby 2.3.0
:
rvm install ruby-2.3.0
# Check ruby:
ruby -v
# Bundler gem
gem install bundler --no-doc --no-ri
For Kip
installation we use the directory /var/www/kip
.
sudo mkdir -p /var/www/kip
# Remember change kip with your user
sudo chown kip:kip /var/www/kip
cd /var/www/
git clone https://github.com/Angelmmiguel/kip.git
cd kip
Install dependencies, create required folder and compile assets:
bundle install --without development test
mkdir -p tmp/pids tmp/sockets log
bundle exec rake assets:precompile
In production, we need to create Rails secret. Execute bundle exec rake secret
and paste the output in secret_key_base
of production environment in config/secrets.yml
. For example:
production:
secret_key_base: c93b185e161f408e87dd3b44....
Now, create MongoDB indexes and launch the application:
RAILS_ENV=production bundle exec rake db:setup
RAILS_ENV=production bundle exec puma -C config/puma.rb
The last step is configuring NGINX to redirect HTTP request to Kip
. Create the NGINX configuration file:
sudo vim /etc/nginx/sites-available/kip.conf
The following configuration file is an example, you need to replace Kip
location and the server_name
.
upstream app {
# Path to Puma SOCK file, as defined previously
server unix:/var/www/kip/tmp/sockets/puma.sock fail_timeout=0;
}
server {
listen 80;
server_name kip.irb.rocks;
root /var/www/kip/public;
try_files $uri/index.html $uri @app;
location @app {
proxy_pass http://app;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
Link the file into NGINX sites-enabled
folder:
sudo ln -s /etc/nginx/sites-available/kip.conf /etc/nginx/sites-enabled/kip.conf
Reload NGINX with sudo service nginx restart
and test your installation opening http://server_name
in your browser :)
![complete](https://cloud.githubusercontent.com/assets/4056725/14587546/19c354be-04b5-11e6-839b-15526ac0220b.png)