Using Gulp to minify CSS, JS and HTML Jekyll
Write a Gulp task to minify CSS, JS and HTML and use it in your jekyll project.

Peatio is an open-source crypto currency exchange program. It is implementation with the rails framework and other cutting edge technology. In this article we will setup the Peatio for production. This article is organized in step by process as listed below.
Create (if it doesn’t exist) deploy user, and assign it to the sudo group:
sudo adduser deploy
sudo usermod -a -G sudo deploy
Re-login as deploy user
su deploy
cd
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git curl zlib1g-dev build-essential \
libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 \
libxml2-dev libxslt1-dev libcurl4-openssl-dev libff
gpg --keyserver hkp://keys.gnupg.net \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable --ruby=2.5.0 --gems=rails
If you want to skip fetching documentation when installing gems, do the following:
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
source /home/deploy/.rvm/scripts/rvm
rvm use 2.5.0
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
cd
sudo nano .bashrc
## Add following lines. at the end of .bashrc file
## Insert your password for m
export DATABASE_HOST=localhost
export DATABASE_USER=root
export DATABASE_PASS=Bilal-IS-Awesome
source ~/.bashrc
Be sure to install the latest stable Redis, as the package in the distro may be a bit old:
sudo add-apt-repository ppa:chris-lea/redis-server
sudo apt-get update
sudo apt-get install redis-server
Download Erlang
wget http://packages.erlang-solutions.com/site/esl/esl-erlang/FLAVOUR_1_genesl-erlang_20.1-1~ubuntu~xenial_amd64.deb
Install using gdebi
sudo apt install gdebi
sudo gdebi esl-erlang_20.1-1~ubuntu~xenial_amd64.deb
echo "deb https://dl.bintray.com/rabbitmq/debian xenial main" | sudo tee /etc/apt/sources.list.d/bintray.rabbitmq.list
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install rabbitmq-server
sudo rabbitmq-plugins enable rabbitmq_management
sudo service rabbitmq-server restart
wget http://localhost:15672/cli/rabbitmqadmin
chmod +x rabbitmqadmin
sudo mv rabbitmqadmin /usr/local/sbin
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind
Configuring Bitcoind
mkdir -p ~/.bitcoin
touch ~/.bitcoin/bitcoin.conf
sudo nano ~/.bitcoin/bitcoin.conf
server=1
daemon=1
# If run on the test network instead of the real bitcoin network
# testnet=1
# You must set rpcuser and rpcpassword to secure the JSON-RPC api
# Please make rpcpassword to something secure, `5gKAgrJv8CQr2CGUhjVbBFLSj29HnE6YGXvfykHJzS3k` for example.
# Listen for JSON-RPC connections on <port> (default: 8332 or testnet: 18332)
rpcuser=deployuser
rpcpassword=deploypass
rpcport=8332
# Notify when receiving coins
walletnotify=/usr/local/sbin/rabbitmqadmin publish routing_key=peatio.deposit.coin payload='{"txid":"%s", "currency":"btc"}'
bitcoind
sudo apt-get install -y dirmngr gnupg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 561F9B9CAC40B2F7
sudo apt-get install apt-transport-https ca-certificates
Note that this only works for Ubuntu 16.04. For other versions of Ubuntu, you have to add the appropriate repository according to Section 2.3.1 of this link.
sudo add-apt-repository 'deb https://oss-binaries.phusionpassenger.com/apt/passenger xenial main'
sudo apt-get update
sudo apt-get install nginx-extras passenger
sudo nano /etc/nginx/passenger.conf
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
passenger_ruby /home/.rvm/rubies/ruby-2.5.0/bin/ruby;
sudo nano /etc/nginx/nginx.conf
include /etc/nginx/passenger.conf;
curl -sL https://deb.nodesource.com/setup_8.x | sudo bash -
sudo apt-get install nodejs
sudo apt-get install gcc g++ make
curl -sL 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-get update && sudo apt-get install yarn
9. Install ImageMagick
```shell
sudo apt-get install imagemagick
echo "export RAILS_ENV=production" >> ~/.bashrc
git clone https://github.com/berycoin-project/Beryxchange.git peatio
cd peatio
git checkout 1-8-stable // Choose your version, but make sure you'll install the same version for peatio-trading-ui
bundle install
bin/init_config
bundle exec rake secret
echo "export SECRET_KEY_BASE=YOUR-SECRET" >> ~/.bashrc
source ~/.bashrc
sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt update
sudo apt-get install ruby2.5 ruby2.5-dev
sudo apt upgrade
bin/setup
PLEASE USE IT IN DEVELOPMENT/TEST ENVIRONMENT ONLY!
sudo nano config/application.yml
sudo nano config/seed/currencies.yml
json_rpc_endpoint: http://deployuser:[email protected]:8332
god -c lib/daemons/daemons.god
By default, it ask for Google Authentication. This parameter can be changed in /config/application.yml
OAUTH2_SIGN_IN_PROVIDER: google
sudo nano config/application.yml
Note: Make sure your host ISN’T an IP in the callback config. Looks like Google auth expect a callback to a DNS only
GOOGLE_CLIENT_ID: <Google id>
GOOGLE_CLIENT_SECRET: <Google secret>
GOOGLE_OAUTH2_REDIRECT_URL: https://yourAwesome-exchange.com:3000/auth/google_oauth2/callback
Change OAUTH2. This parameter can be changed in /config/application.yml ->
OAUTH2_SIGN_IN_PROVIDER: auth0
sudo nano config/application.yml
AUTH0_OAUTH2_DOMAIN: DOMAIN
AUTH0_OAUTH2_CLIENT_ID: CLIENTID
AUTH0_OAUTH2_CLIENT_SECRET: CLIENTSECRET
AUTH0_OAUTH2_REDIRECT_URL: REDIRECTURI-IN-HTTPS
Finalize the config; open /config/application.yml Set the DNS of your host (IP won’t work if you use Google Authentication)
sudo nano config/application.yml
URL_HOST: yourAwesome-exchange.com:3000
Start the server:
```shell
bundle exec rails server
OR Make sure the port 3000 is open your server Start the server by passing the ip in parameter
bundle exec rails server -b 0.0.0.0
You can also provide a port
bundle exec rails server -p 3000
Validate the server is working:
sudo apt-get update
sudo apt-get install nginx
sudo ufw allow 'Nginx HTTP'
systemctl status nginx
At this point you should see nginx running. But you need to edit the default config to setup the reverse proxy. Open /etc/nginx/sites-available/default in your favorite editor Replace the content of the file by the following
server {
server_name http://YOUR-AWESOME-WEBSITE.com;
listen 80 default_server;
location ~ ^/(?:trading|trading-ui-assets)\/ {
proxy_pass http://127.0.0.1:4000;
}
location / {
proxy_pass http://127.0.0.1:3000;
}
}
ruby -e "require 'openssl'; require 'base64'; OpenSSL::PKey::RSA.generate(2048).tap { |p| puts '', 'PRIVATE RSA KEY (URL-safe Base64 encoded, PEM):', '', Base64.urlsafe_encode64(p.to_pem), '', 'PUBLIC RSA KEY (URL-safe Base64 encoded, PEM):', '', Base64.urlsafe_encode64(p.public_key.to_pem) }"