Skip to content

Instantly share code, notes, and snippets.

@peteroid
Last active May 24, 2017 18:16
Show Gist options
  • Save peteroid/08de96bc597e8ab62fa5a44daabd79f5 to your computer and use it in GitHub Desktop.
Save peteroid/08de96bc597e8ab62fa5a44daabd79f5 to your computer and use it in GitHub Desktop.
Install skygear server on centos x64. Config with postgresql, nginx
## obtain the official binary
# get the lastest release on https://github.com/SkygearIO/skygear-server/releases/latest
wget https://github.com/SkygearIO/skygear-server/releases/download/v0.24.0/skygear-server-linux-amd64.tar.gz
# uncompress the file
tar zxvf ./skygear-server-linux-amd64.tar.gz -C .
## postgresql
# setup postgresql. mostly follow instructions on https://wiki.postgresql.org/wiki/YUM_Installation
# edit repo file to exclude postgresql. then install the rpm through the package manager
sudo yum install postgresql96-server
sudo /usr/pgsql-9.6/bin/postgresql96-setup initdb
sudo systemctl enable postgresql-9.6.service
sudo systemctl start postgresql-9.6.service
# postgix is also required by the skygear
sudo yum install postgresql96-contrib postgis2_96
# config postgresql. the followings would be depended on version as well as os
# by default, postgresql would use ident for tcp connection. we need to change it to trust to allow all the connections
sudo vi /var/lib/pgsql/9.6/data/pg_hba.conf
# replace `local all all ident` with `local all all trust`
# do the same for host ipv4 and ipv6. !!! import to do this for both v4 and v6 !!!
# restart the postgresql
sudo systemctl restart postgresql-9.6.service
# test your postgresql
psql -U postgres -h localhost
## config skygear
cd skygear-server-0.24
# create the env file for skygear. refer to https://github.com/SkygearIO/skygear-server/blob/master/.env.example
vi .env
# launch the skygear server
./skygear-server-0.24
## extra
# add skygear server to your command list
mkdir -p ~/bin
ln -s ./skygear-server-0.24 ~/bin/skygear-server
source ~/.bashrc
skygear-server # launch the gear!
# config nginx server block with proxy for ssl support and websocket
# {
# # use this to pass the ssl connection to the skygear
# proxy_pass http://your-skygear-app.com:3000;
# # enable websocket support
# proxy_http_version 1.1;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection "upgrade";
# }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment