nicotroia / docker-node-nginx

Simple containerized node app with nginx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dockerized node + nginx app

This sample project includes a basic node (express) app, spawned on 2 instances, load-balanced via nginx. Refresh the page to see round-robin in action with a custom message from each container.

Installation

  • Install Docker
  • cp .env.sample .env and modify if necessary (read on)

Create machine (optional)

  • Run docker-machine create -d virtualbox my-project to create a machine on virtualbox
  • View the machine docs for specific commands for other drivers
  • Run eval $(docker-machine env my-project) to run commands against the new machine
    • If you created a machine on a remote host you'll need to copy files there
      • Find pwd of ssh user: docker-machine ssh my-project pwd (for me, /root)
      • Copy project files to remote host: docker-machine scp -r ./ my-project:/root/
      • Modify .env to specify the project root on host ROOT=/root

Start

  • Run docker-compose -f docker-compose.yml up to start the containers

Connecting

  • (optional) Run docker-machine ip my-project to find the machine ip
  • Point your browser to the ip (localhost:80) or use curl

About

Simple containerized node app with nginx


Languages

Language:JavaScript 80.1%Language:HTML 8.5%Language:Dockerfile 8.5%Language:CSS 2.9%