Skip to main content

Getting Started

Installation

Clone the repo and open the directory:

git clone https://gitlab.com/xcapit-foss/api-app auth-service
cd auth-service

Ensure you have Docker and Docker compose installed, and configuration files, then:

docker-compose build
docker-compose up -d

Creating a database

docker-compose exec <YOUR_HOST_HERE> psql -U <YOUR_USER_HERE>
CREATE DATABASE <YOUR_DB_NAME_HERE>

Making db migrations

docker-compose exec api-app python manage.py makemigrations 
docker-compose exec api-app python manage.py migrate

Now in http://localhost:9070/ you can see the api.

Tests (pytest)

To run the tests:

docker-compose exec api-app pytest

Configuration

For configuration settings you could see and change the next file.
./variables.env
./docker-compose.yml

Example files

# variables.env
DEBUG=1
SECRET=<YOUR_SECRET_HERE>
POSTGRES_USER=<YOUR_USER_HERE>
POSTGRES_DB=<YOUR_DB_NAME_HERE>
POSTGRES_PASSWORD=<YOUR_PASS_HERE>
POSTGRES_HOST=<YOUR_HOST_HERE>
POSTGRES_PORT=<YOUR_PORT_HERE>
DJANGO_LOG_LEVEL=INFO

# APIs
API_NOTIFICATIONS=http://localhost:9051/v1/api/

# OTHERS
PWA_DOMAIN=http://localhost:8100/

# Firebase clients
CLIENT_ID_1=<YOUR_FIREBASE_CLIENT_ID_1_HERE>
CLIENT_ID_2=<YOUR_FIREBASE_CLIENT_ID_2_HERE>
CLIENT_ID_3=<YOUR_FIREBASE_CLIENT_ID_3_HERE>

# Mercadopago
API_MERCADOPAGO=https://api.mercadopago.com/
MERCADOPAGO_ACCESS_TOKEN=<YOUR_MERCADOPAGO_ACCESS_TOKEN_HERE>
MERCADOPAGO_PUBLIC_KEY=<YOUR_MERCADOPAGO_PUBLIC_KEY_HERE>

SENTRY_HOST=<YOUR_SENTRY_HOST_HERE>
SENTRY_KEY=<YOUR_SENTRY_KEY_HERE>
# docker-compose.yml
version: "3.2"
services:
api-app:
build: .
volumes:
- .:/code
command: python3 manage.py runserver 9070
ports:
- 9070:9070
env_file:
- ./variables.env

postgres-api-app:
image: postgres:12.0
volumes:
- ./postgres:/var/lib/postgresql/data
ports:
- 5435:5432
env_file:
- ./variables.env

Xcapit Auth Service depends on backend services for send notifications.

Schema

The next schema represent Xcapit Auth Service interaction with services.

smart wallet services relation