Skip to content

Latest commit

 

History

History
101 lines (86 loc) · 2.58 KB

how-to-deploy-a-cezerin2-on-ubuntu-16-04.md

File metadata and controls

101 lines (86 loc) · 2.58 KB

How to deploy a Cezerin on Ubuntu 16.04

1. Create droplet

I'll use DigitalOcean to deploy Cezerin2.

  1. Click Create droplet
  • Choose an image: Ubuntu 16.04.4 x64
  • Choose a size: 2 GB (RAM), 1 vCPU, 50 GB (SSD)
  • Choose a datacenter region: San Francisco
  1. Then SSH to droplet.

2. Install Docker

Docker guide.

sudo apt-get update
sudo apt-get install \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"
sudo apt-get update
sudo apt-get install docker-ce

3. Run MongoDB

docker run --name store-db -v /var/www/store-db:/data/db -d mongo:latest

4. Run Cezerin

docker run -d \
--name store \
--link store-db:db \
-p 80:80 \
-e DB_HOST=db \
-e DB_PORT=27017 \
-e DB_NAME=shop \
-v /var/www/store/content:/var/www/cezerin/public/content \
cezerin2/cezerin2:latest

Check logs

docker logs store

5. Preparing Database

Run npm run setup on Cezerin2 container to add default data and create indexes.

sudo docker exec store bash -c "npm run setup"

6. Setup domain with CloudFlare

Cloudflare.

  • Get droplet IP on DigitalOcean DigitalOcean IP Address

  • Add A and CNAME to DNS on CloudFlare CloudFlare DNS

  • Set SSL to Flexible on CloudFlare CloudFlare SSL

  • Turn on Always use HTTPS on CloudFlare CloudFlare Always HTTPS

7. Turn off Developer Mode

By default, Cezerin is in developer mode. This means you can access API and Dashboard without access tokens.
To turn off developer mode, you need to do:

  • Add access token in Dashboard or MongoDB
  • Set SMTP server from Dashboard or in config/server.js
  • Remove developerMode from config/server.js
  • Remove developerMode from config/admin.js
  • npm run build inside Cezerin container
  • pm2 reload api inside Cezerin container