Getting Started

Setting up meanbase for development

Since we are working with node and npm make sure they are installed on your machine. There are several tutorials on the web for how to do that on your machine. If you're using mac, I recommend using homebrew

Running with docker

Make sure bower is installed globally

npm i bower -g

Install npm and bower modules by running

npm run prepare

Install Docker on your machine (you need at least 4G of ram)

Start the server by running

npm run server

Open localhost:3030 in your browser

If you don't choose to install Docker

Make sure bower is installed and npm run prepare

Install GraphicsMagick and MongoDB

  • If your on Linux
    sudo apt-get install -y graphicsmagick
    sudo apt-get install mongodb-server

  • If your on a mac
    brew install graphicsmagick
    brew install mongodb

Run mongo and the server

  • Start Mongodb in one terminal or cmd
  • In the root of meanbase run
    • npm start
  • Open the app in your browser
  • You can stop mongo and the server with ctrl-c

Making changes

If you want to update the app make sure to run watch so that your stylus, jade, and es8 files will be updated.

npm run watch

cancel with ctrl-c

Deploying a meanbase instance

Meanbase uses docker. So you can

  1. create a droplet on digitalocean.com
  2. Choose the Docker Image
  3. Upload your passwordless ssh key and begin working with meanbase. IE: ssh-copy-id user@your-server-ip-address

Create a file called meanbase.env in the root of meanbase. Don't share it with anyone or attach include it in your repo, this will contain your app secret for encrypting passwords and settings which should be kept secret.

Required Options

At a minimum this file needs

FEATHERS_AUTH_SECRET=your-app-secret
NODE_ENV=production
DATABASE_URL=mongodb://db/meanbase
DATABASE_NAME=meanbase
DOMAIN=your-domain.com
EMAIL_USER=your-site-gmail-user-name
EMAIL_PASS=your-site-gmail-password
[email protected]

NOTE: If you are running mongoDB locally the MongoDB server name must be db since in Docker that will refer to the MongoDB vm

The email settings are for account verification and resetting your password

Additional Options

These variables are optional.

MAILGUN_API_KEY=mailgun-api-key
MAILGUN_DOMAIN=your-domain.com
[email protected]
[email protected]
PRERENDER_TOKEN=prerender-token-from-prerender.io
RESET_SEED=false
SEED=true

The mailgun api is for blog email subscription so that when you publish a page your subscribers are informed.

Prerender is a service that's free to an extent and will pre-render your pages for SEO purposes for Yahoo and Bing.

Seed will populate the site with dummy default data. Reset seed will reset all your data to default data each time the server restarts.

npm run compile

Now we want to compile all our es8, jade, stylus, combine them into 1 file and build our dist folder.

npm run compile

NOTE: Makes sure you can make password-less ssh into your host server.

Connect to your docker server instance

Now we must tell docker that we want to interact with your live server. We create a new Docker Machine instance passing in the IP of our server.

docker-machine create --driver generic --generic-ip-address=your-server-ip-address your-custom-machine-name

Then we point our terminal to it.

eval $(docker-machine env you-custom-machine-name)

Deployment

Finally we upload our dist folder to the server and have it install production dependencies

docker-compose up -d

results matching ""

    No results matching ""