Skip to content

Udagram V2 - microservices at scale! Your Own Instagram on AWS Develop a cloud-based application for uploading and filtering images!

Notifications You must be signed in to change notification settings

kendyjm/udagram-photo-sharing-social-microservices

Repository files navigation

CLOUD DEVELOPER (nd9990) - PROJECT 3 - Udagram V2 - microservices at scale! Your Own Instagram on AWS!

master: Build Status - development: Build Status

Context

Udacity NANODEGREE Cloud Developer - My Root repository

Udagram Image Filtering Microservice

Udagram allows users to register and log into a web client, post photos to the feed, and process photos using an image filtering microservice.

The project is split into four parts:

  1. The Frontend, an Ionic client web application which consumes the RestAPI feed and user.
  2. The RestAPI Feed Backend, a Node-Express feed microservice.
  3. The RestAPI User Backend, a Node-Express user microservice.
  4. The reverse proxy server, a NGINX proxy server.

Architecture

architecture

Getting started

Prerequisites

You need to install:

Installation

Test that your installation is successful with the following commands:

aws --version
docker --version
docker-compose version --short
eksctl version
kubectl version --short --client

setupversions

Setup Environment Variables

Open your bash profile to store your application variables at OS level to use them within and across applications:

open ~/.profile

Copy and Paste the bash scripts bellow with your values:

export DB_USERNAME=your postgress username;
export DB_PASSWORD=your postgress password;
export DB_NAME=your postgress database;
export DB_HOST=your postgress host;
export AWS_REGION=your aws region;
export AWS_PROFILE=your aws profile;
export AWS_MEDIA_BUCKET=your aws bucket name;
export JWT_SECRET=your jwt secret;
export ACCESS_CONTROL_ALLOW_ORIGIN=url of the frontend;

Source your .profile to execute your bash scripts automatically whenever a new interactive shell is started:

source ~/.profile

Running locally with Docker

1) Pull or build images

To run the docker images, 2 options:

  • 1a) Get Docker images from Docker Hub
  • 1b) Build the Docker images
1a) Get Docker images from Docker Hub

The project's images are available at Docker Hub :

dockerhub

Just push these images executing this script:

docker pull kendyjm/udacity-restapi-feed:latest
docker pull kendyjm/udacity-restapi-user:latest
docker pull kendyjm/udacity-nginx-reverseproxy:latest
docker pull kendyjm/udacity-frontend:latest
1b) Build the Docker images

Build the docker images by following the documentation in udacity-c3-deployment/docker

2) List your docker images

Check images available : docker images

dockerimages

3) Run

Run your docker containers: docker-compose up

dockercomposeup

4) Access Udagram

Browse the frontend application : http://localhost:8100/

udagramlocalhost

To exit run control + C

Run with a Kubernetes Cluster on Amazon EKS

Create your cluster with eksctl by following documentation in udacity-c3-deployment/eks

Your cluster is created and visible in the AWS Console/EKS: eksclusterconsole

Setup Kubernetes Environment

Setup the ubernetes environment by following the documentation in udacity-c3-deployment/k8s

Check status of all resources (services, delpoyments, pods, hpa)

kubectl get all

kubernetesresourcesstatus

Check pods logs

kubectl logs <podId>

kubernetespodslogs

Connect the Services with Port Forwarding

Use Port Forwarding to the Frontend and Reverse Proxy services: The port forwarding must be done in Separate terminals, to run both services at the same time.

kubectl port-forward service/frontend 8100:8100
kubectl port-forward service/reverseproxy 8080:8080

Browse the frontend application : http://localhost:8100/

CI/CD with Travis

  • Sign up for Travis and connect your Github application repository to TravisCL.
  • Have a look to the config file that will be read by Travis, at the root of the repository. It needs some environment variables.
  • Add your environment variables to the project repository in Travis by selecting the setting option.
  • Commit and Push your changes trigger a Travis build.
  • Check the build status page to see if your build passes or fails according to the return status of the build command by visiting TravisCL and selecting your repository.

traviscibuildpassed