Udagram is a simple cloud application that is an Instagram clone. It 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:
- The Frontend, an Ionic client web application which consumes the RestAPI feed and user.
- The RestAPI Feed Backend, a Node-Express feed microservice.
- The RestAPI User Backend, a Node-Express user microservice.
- The Reverse Proxy server, a NGINX proxy server.
The following tools need to be installed on your machine:
Furthermore, you need to have:
- an Amazon Web Services account
- a DockerHub account
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
- Navigate to the udagram-deployment/docker directory.
- Build a docker image of the reverseproxy with
docker build -t {your_docker_usernam}/reverseproxy .
- Navigate to the udagram-api-user directory.
- Build a docker image of the backend user microservice with
docker build -t {your_docker_username}/restapi-user .
- Navigate to the udagram-api-feed directory.
- Build a docker image of the backend feed microservice with
docker build -t {your_docker_username}/restapi-feed .
- Navigate to udagram-frontend directory.
- Build a docker image of the frontend with
docker build -t {your_docker_username}/frontend .
- Publish the reverseproxy image with docker push {your_docker_username}/reverseproxy.
- Publish the backend user image with docker push {your_docker_username}/restapi-user.
- Publish the backend feed image with docker push {your_docker_username}/restapi-feed.
- Publish the backend feed image with docker push {your_docker_username}/frontend.
- Sign up for Travis and connect your Github application repository to TravisCL.
- Have a look at 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 to 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 TravisCI and selecting your repository.
docker-compose up
Browse the frontend application at http://localhost:8100/
- Navigate to the udagram-deployment/k8s/ directory.
- Modify the configuration values in aws-secret.yaml, env-configmap.yaml, env-secret.yaml.
- Set the correct docker hub username in the backend-feed-deployment.yaml, backend-user-deployment.yaml, frontend-deployment.yaml, reverseproxy-deployment.yaml files.
- Repeat step 3 for the docker-compose-build.yaml and docker-compose.yaml files in the udagram-deployment/docker directory.
- Deploy to Kubernetes cluster with
kubectl apply -f {file_name}.yamlfor each file in this directory.
kubectl get all
kubectl logs <podId>
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 at http://localhost:8100/