1.0.1 • Published 6 years ago

ai-challenges v1.0.1

Weekly downloads
-
License
-
Repository
-
Last release
6 years ago

AI Challenges Portal

Storybook | Endpoint Build Status | Endpoint Build Status

architecture

Getting Started

Folder Structure

The project is a monolith that includes backend and frontend side. All the things that you need to run the project is self contained.

Although you can see the folder structure on GitHub or your file system, we annotated the most relevant folder of the project:

.
├── README.md           # ← Hey, hello 👋
├── backend
│   ├── Dockerfile
│   ├── src             # Backend source code entry point
│   │   ├── config      # Environment configuration  
│   │   │   ├── environments
│   │   │   │   ├── development.ts
│   │   │   │   ├── production.ts
│   │   │   │   ├── stage.ts
│   │   │   │   └── test.ts
│   │   └── tests       # backend only tests           
├── docker-compose.yml
├── docs                
├── frontend            # amazing frontend stuff
│   └── public          # static assets files
├── serverless          # maintanance scripts
├── tests               # e2e integration tests
└── travis              # Continous Integration configuration

First Run

Code Dependencies

Just install it using npm.

$ npm install

At the root of the project it will be install all the dependencies necessaries.

Alternatively you can install just a concrete folder entering in it and running the command, e.g.

$ cd backend && npm install

Data Containers

The services used by this project are:

  • Postgres 9.6.
  • Redis 3.2.
  • Elasticsearch 6.2.2.

We use docker with docker-compose for services isolation, so you don't need to install this service in your local machine and pollute your file system.

Instead, we use docker-compose for run the services inside containers.

If you don't have it, first run $ brew install docker docker-compose

Then you need to initialize the data containers:

$ docker-compose up db redis elasticsearch

Check docker-compose --help to know more and the configuration file docker-compose.yml.

After your database connection is stablished, you need to run the following script at backend to hydratate your data containers:

  1. Load initial data to the database: npm run fixtures:restore
  2. Project Build: npm run build
  3. Run Database migration: npm run migrations:dev:run
  4. ElasticSearch synchronization: npm run elastic:sync
  5. Start the backend: npm run start
  6. Start the frontend: Open a new tab on the terminal, go to the frontend and run npm run dev
  7. Login: Open a new tab on the terminal go to the backend folder and run npm run token. Click on the url to automatically sign in as the admin user.

Development Workflow

The frontend or backend side can be bootstrapped in development environment with the following scripts:

Main Process

$ npm run dev # Start the main process

Testing Suite

$ npm run test # Run the entire test suite
$ npm run test:watch # Run the entire test suite with live reloading
$ npm run test:run src/tests/integration/challenges.test.ts # Execute a particular testing file

Scripts

$ npm run script src/scripts/token/getToken.ts # execute a particular script

Workflow

npm.io

The project follows git-flow approach, and you can find two main branches:

develop

guachinegro.sl.cloud9.ibm.com

Represent Latest delivered development changes or also called integration branch.

master

aichallenges.sl.cloud9.ibm.com

Represent production-ready state of source code.

Development Workflow

It mandatory follow this flow steps in order to run the correct Continous Integration services involved.

A common develop workflow has the following steps:

  1. Create a fork from develop branch. It's not mandatory, but start the branch name with the issue number is a good practice. e.g. 1337-panel-option.

  2. Do your things. Do as many commits as you need. Consider write good commit messages.

  3. When you thing it's ready, create a New pull request petition. It will be run a Travis build for passing al test and create a production ready docker image.

  4. Assign the PR to a reviewer, After the reviewer approach, the branch can be merged.

  5. Now that the PR is integrated, the source code will be deployed at develop endpoint.

  6. If all looks good, then you can create a New pull request integration to merge develop to master.

Documentation

You can find the rest on docs.

1.0.1

6 years ago