Skip to content

mjhea0/microservice-movies

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
September 15, 2017 17:11
September 16, 2017 09:43
ecs
September 15, 2017 18:21
September 16, 2017 11:40
September 10, 2017 11:12
May 4, 2017 18:36
May 11, 2017 16:44
August 13, 2018 07:13
September 17, 2017 18:54
May 11, 2017 15:46
May 11, 2017 16:24
September 15, 2017 14:49
May 13, 2017 06:51

Developing Microservices - Node, React, and Docker

Build Status CircleCI

http://mherman.org/microservice-movies/

Architecture

Name Service Container Tech
Web Web web React, React-Router
Movies API Movies movies Node, Express
Movies DB Movies movies-db Postgres
Swagger Movies swagger Swagger UI
Users API Users users Node, Express
Users DB Users users-db Postgres
Functional Tests Test n/a TestCafe

Want to learn how to build this project?

Check out the blog post.

Want to use this project?

Setup

  1. Fork/Clone this repo

  2. Download Docker (if necessary)

  3. Make sure you are using a Docker version >= 17:

    $ docker -v
    Docker version 17.03.0-ce, build 60ccb22

Build and Run the App

Set the Environment variables

$ export NODE_ENV=development

Fire up the Containers

Build the images:

$ docker-compose build

Run the containers:

$ docker-compose up -d

Migrate and Seed

With the apps up, run:

$ sh init_db.sh

Sanity Check

Test out the following services...

(1) Users - http://localhost:3000
Endpoint HTTP Method CRUD Method Result
/users/ping GET READ pong
/users/register POST CREATE add a user
/users/login POST CREATE log in a user
/users/user GET READ get user info
(2) Movies - http://localhost:3001
Endpoint HTTP Method CRUD Method Result
/movies/ping GET READ pong
/movies/user GET READ get all movies by user
/movies POST CREATE add a single movie
(3) Web - http://localhost:3007
Endpoint HTTP Method CRUD Method Result
/ GET READ render main page
/login GET READ render login page
/register GET READ render register page
/logout GET READ log a user out
/collection GET READ render collection page
(4) Movies Database and (5) Users Database

To access, get the container id from docker ps and then open psql:

$ docker exec -ti <container-id> psql -U postgres
(6) Functional Tests

With the containers up running and TestCafe globally installed, run:

$ sh test.sh
(7) Swagger - http://localhost:3003/docs

Access Swagger docs at the above URL

Commands

To stop the containers:

$ docker-compose stop

To bring down the containers:

$ docker-compose down

Want to force a build?

$ docker-compose build --no-cache

Remove images:

$ docker rmi $(docker images -q)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published