almajo / ugr-master-cc

Cloud Computing Project 18/19
GNU General Public License v3.0
0 stars 0 forks source link

Build Status

infogration-backend

The usage and routes of the most recent version is documented here.

Description

This project is a RESTful WebService, which will be used for infogration, an Android app, which I developed in a previous class in Germany. It answers the most important questions asked by refugees coming to Germany. Questions range from job-hunting, housing to everyday-life. The content is created by mentors of Diakonie Würzburg, an institution which works with young refugees on a daily basis. At the moment all the questions and answers are hard-coded in the application, which is undesirable as changes should be made by other persons, too.

Local Installation and execution

I assume you already have a valid go working directory structure. Further do you need a running MongoDB-server somewhere - by default it will look at localhost:27017. Then you can run the following:

go get https://github.com/alex1ai/ugr-master-cc
cd $GOPATH/src/github.com/alex1ai/ugr-master-cc
go build & ./ugr-master-cc

which will start the service locally on 0.0.0.0:3000 by default. Set environment variables $API_IP and/or $API:PORT to change.

Architecture

This service stores the data which will be requested (get) by the Android-App, and updated (update/post/delete) by another webservice from responsible persons via GUI. Here we only care about the data-handling REST-service as this needs to run permanently in the cloud, in order to allow continous content upgrades to the users of the app.

Highlights:

Deployment

Deployment https://infogration.now.sh

While there are different PaaS deployment services out there, I chose zeit.co as it offers nice tutorials and a lightweight deployment mechanism. Furthermore it offers integration of Docker (i.e. I can use any language I want besides Node/JS, which others offer exclusively), CI-support of Travis for automatic testing, and Github-Integration which deploys by pushing to master (if configured this way). No configuration is needed if you want to use Now. Everything is build automatically and aliased as infogration if someone pushes to master or via Pull Requests. Deployment through Now is part of Travis execution after it passed all tests. If the tests fail, there will be no new deployment.

Provision

Using GUI of Azure

For easy provisioning on any virtual machine of this webservice, I chose Ansible for its configuration management. Ansible works, in contrast to e.g. Puppet, in a push-way and is a good choice for this kind of project because one doesn't need to install anything on the Client-vm.
This Project is deployed in Microsoft's Azure cloud with a low-resourced VM. How to provision to your cloud and more information about the chosen configuration can be found here.

MV: 40.89.159.84

Automatic provision via script

As of milestone 4, we can create VMs in Azure automatically via acopio.sh. This provides all the documentation and justification for the chosen image, ressources and location. Currently the server is running on Ubuntu 16.04 LTS in France-Central on a cheap Azure virtual machine (B1s).

MV2: 40.89.159.84

Orchestration via Vagrant

Vagrant is a controller to create and manage virtual machines from command line. For milestone #5 I added the option to start virtual machines via this tool. Therefore I made to different versions:

  1. Start webservice locally in 2 VMs
  2. Start webservice in Azure subscription

More information and documentation is given here.

Despliegue Vagrant: 20.188.38.46

Containers

The project can be deployed with Docker (docker-compose) and the service api is deployed as an image on Docker Hub as well.

If you had docker-compose locally installed you can directly start everything with the provided docker-compose.yml. You can also run the service with sudo docker run --rm -e MONGO_IP={IP of running MongoDB} alexgrimm/infogration-backend if you have a MongoDB running somewhere.

Contenedor: http://infogration-backend.francecentral.cloudapp.azure.com

Everything about the containers and how to run them is documented here.