Coder Social home page Coder Social logo

dubewarsagar / provisioning-backend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rhenvision/provisioning-backend

0.0 0.0 0.0 17.95 MB

Microservice providing API to provisioning capabilities

License: GNU General Public License v3.0

Shell 1.77% Go 95.43% Makefile 1.51% PLpgSQL 1.16% Dockerfile 0.13%

provisioning-backend's Introduction

provisioning-backend

Provisioning backend service for cloud.redhat.com.

Components

  • pbapi - API backend service
  • pbworker - backend job processing worker
  • pbmigrate - database migration tool with embedded SQL scripts

Building

Particular version of Go and tools are required for successful build. The install-go make target will use already installed version of go to perform go download commend to install Go into $HOME/sdk.

make install-go
make install-tools
make build

Configuration

Configuration is done via configuration files in config/ directory, see config/api.env.example file for list of options with documentation. The application expects config/app.env file to be present, other programs from this git repo also look up additional file which will override values:

  • pbworker looks up config/worker.env
  • pbmigrate looks up config/migrate.env
  • typesctl looks up config/typesctl.env
  • integration (DAO) tests look up config/test.env

Environmental variables always override any values from configuration files, or can be used for complete configuration of the application without any .env file.

Finally, when running the app in Clowder environment, some configuration values are overwritten by those from Clowder. See consoleDot shared library for more details.

Development setup

To run all the components from this repository, you will need:

  • Go compiler
  • PostgreSQL server with UUID module
  • GNU Makefile
dnf install postgresql-server postgresql-contrib
make run

Code style

We run go fmt, goimports, go vet and golangci-lint lint suite via GitHub Actions. To run them locally do:

make install-tools
make fmt lint

Make sure to set your editor to use goimports formatting style of code.

Migrations

Migrations can be found in internal/db/migrations in SQL format, the only supported database platform is PostgreSQL. To create a new migration:

make generate-migration MIGRATION_NAME=add_new_column

We currently do not allow down migrations, so delete the down.sql file and do not commit it into git (it will fail build).

To apply migrations, build and run pbmigrate binary. This is exactly what application performs during startup. The pbmigrate utility also supports seeding initial data. There are files available in internal/db/seeds with various seed configurations. Feel free to create your own configuration which you may or may not want to commit into git. When you set DB_SEED_SCRIPT configuration variable, the migration tool will execute all statements from that file. By default, the variable is empty, meaning no data will be seeded.

Building container

podman build -t pb .
podman run --name pb1 --rm -ti -p 8000:8000 -p 5000:5000 pb
curl http://localhost:8000
curl http://localhost:5000/metrics

Contributing

Check out CONTRIBUTING.md

License

GNU GPL 3.0, see LICENSE

provisioning-backend's People

Contributors

lzap avatar ezr-ondrej avatar adiabramovitch avatar avitova avatar amirfefer avatar akhil-jha avatar tpapaioa avatar mshriver avatar mayurilahane avatar jrusz avatar aadhikar avatar pablomh avatar croissanne 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.