Git Product home page Git Product logo

fna's Introduction

github workflow Build Status Coverage Status Erlang/OTP Release

The Football News Aggregator application

Authors: Thiago Esteves ([email protected]).

Introduction

The Football News Aggregator (FNA) is a home assignment test requested by Forza Football as part of the Technical Interview Process. All the special details about the application can be found in the doc folder under the name of "Forza Football home assignment.pdf" .

The initial Design for the servers will be as the picture below:

FCA Design

The image below shows the supervision tree captured from the final application:

Supervision Tree

What can be improved

1- It is missing deploy files as docker, aws cloudFormation, etc;
2- It is possible to improve how both providers are connected by the collect_producer server, maybe each one could
have its own reference (ID) and the database could request only the one that timed out.
3- Implement some of the TODOs indicated in the code
4- Write some tests to check if the database is consistent with the data collected
5- Increase the number of unit test to achieve 100% coverage
6- Add configuration file for github actions

Installing and running PostgreSQL locally (default)

For local installation:

sudo apt update
sudo apt install postgresql postgresql-contrib

Once PostgreSQL is installed, we can create the user that will be used by Ecto:

sudo -u postgres psql
postgres=# CREATE USER postgres;
postgres=# ALTER USER postgres PASSWORD 'postgres';
postgres=# ALTER USER postgres WITH SUPERUSER;

Create the database using Ecto

mix ecto.drop -r Fna.Repo && mix ecto.create -r Fna.Repo && mix ecto.migrate -r Fna.Repo

After the application has created the Fna.Repo, you can access the database via this command

sudo -u postgres psql -W fna_app_repo # password is postgres
fna_app_repo=# SELECT matches.id AS id, home_team, away_team, created_at, kickoff_at, server_name FROM matches;

Running PostgreSQL in a docker

Create and run a docker image with postgres:12.4-20.04_beta

docker run -d --name postgres-container -e TZ=UTC -p 30432:5432 -e POSTGRES_PASSWORD=postgres ubuntu/postgres:12.4-20.04_beta

Change the Ecto configuration at config/config.exs to use the port 30432

config :fna_app, Fna.Repo,
  database: "fna_app_repo",
  username: "postgres",
  password: "postgres",
  port: "30432",
  pool_size: 10

Create the database using Ecto

mix ecto.drop -r Fna.Repo && mix ecto.create -r Fna.Repo && mix ecto.migrate -r Fna.Repo

After the application has created the Fna.Repo, you can access the database via this command

docker exec -it postgres-container /bin/bash
root@86f6777831fe:/# psql -U postgres -W fna_app_repo
fna_app_repo=# SELECT matches.id AS id, home_team, away_team, created_at, kickoff_at, server_name FROM matches;

PS: these informations can be checked at:

https://hub.docker.com/r/ubuntu/postgres: 

Compiling and Running

To compile and run for your machine just call the following command in the CLI:

$ iex -S mix

Testing and checking

Execute the following commands to get more information

$ mix test --cover
$ mix coveralls.html

fna's People

Contributors

thiagoesteves avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.