This is my personal sandbox to use cutting-edge features around MEAN (actually possibly included non-MEAN stack)
MEAN-EDGE works with Node.js version 6.0.0 (current latest stable)
use official installer https://nodejs.org/download/
or use homebrew http://brew.sh/ brew install node
or use nvm https://github.com/creationix/nvm nvm istall 6.0.0
current latest stable is 3.8.6. If you need to update npm itself, do the following
npm update npm -g
If you want to use MongoDB in your local dev, You have to install it. see https://www.mongodb.org/downloads#production
After installation, you run mongod
and start mongoDB
git clone https://github.com/memolog/mean-edge.git
cd mean-edge
npm install
No dependencies for global, MEANEDGE installs all development dependencied into node_modules and use them from npm scripts.
cd backend
npm run dev
You can see the 'Backend works!' message at http://localhost:3000/test If some source ts files changed, The dev script automatically compile them and restart server.
cd frontend
npm run dev
You can see http://localhost:8000/ If some source ts/scss files changed, The dev script automatically compile them and restart server.
see https://www.docker.com/products/docker-toolbox and install it
After install Docker Toolbox, start Docker Machine
docker-machine start
cd backend
docker build -t mean-edge-backend .
cd nginx
docker build -t mean-edge-nginx .
The mean-edge-nginx container is based on https://github.com/jwilder/nginx-proxy
docker run --name mongo mongo:latest
docker run -d -p 80:80 --name nginx -v /var/run/docker.sock:/tmp/docker.sock:ro mean-edge-nginx
docker run --name app --link mongo:mongo -e VIRTUAL_HOST=example.com mean-edge-backend
MEANEDGE uses 'example.com' as a virutual host defaultly, so add it in your local /etc/hosts as follows
First, get docker-machine ip as follows
docker-machine ip
And then, add example.com with the above ip in your /etc/hosts, like
192.168.99.100 example.com
open http://example.com with your browser, you can see the MEANEDGE site open http://example.com/test, you can see the backend response
docker kill app nginx mongo
docker rm app nginx mongo
docker rmi mean-edge-nginx mean-edge-backend mongo:latest
- Create three nodes like, lb, server and db
- Create mongdb service
- Move Services
- Push 'Create Service' button
- Choose mongo in Database servers at Jumpstarts
- Add Deploy tags 'db'
- Add Ports 27017 as a published port
- Create and deploy
- Create nginx service
- Move Services
- Push 'Create Service' button
- Choose mean-edge-nginx from 'My repositories'
- Add Deploy tags 'server'
- Add Ports 80 as a published port
- Set Volumes PATH:/tmp/docker.sock, Host Path: /var/run/docker.sock (not writable)
- Create and Deploy
- Create backend service
- Move Services
- Push 'Create Service' button
- Choose mean-edge-backend from 'My repositories'
- Add Deploy tags 'server'
- Add Ports 3000 as a published port
- Set Environment variables VIRTUAL_HOST, your_host (example.com)
- Add links mongodb service created at step 2, must set alias name to 'mongo'
- Create and Deploy
- Create haproxy(lb) service
- Move Services
- Push 'Create Service' button
- Choose dockercloud/haproxy in Proxies at Jumpstarts
- Add Deploy tags 'lb'
- Add Ports 80 as a published port
- Add links mean-edge-nginx service created at step 3
- Create and Deploy