Giter Club home page Giter Club logo

integer's Introduction

Integer

Member Management Service

GitHub Release Rust Rocket PostgreSQL GitHub Workflow License

Build

Requirement

Guide

  1. Clone the repository:

    $ git clone https://github.com/int-i/integer.git
  2. Build the source:

    $ cargo build
  3. Run PostgreSQL:

    $ docker-compose -f docker-compose.db.yml up -d
  4. Run the application:

    $ DB_USER=inti DB_PASSWORD=password cargo run

    See Environment Variables

Deploy

Requirement

  • Docker
  • db/password.txt - the DB password file
  • cert.pem - the server certificate
  • privkey.pem - the private key for the certificate
  • chain.pem - (Option) the intermediate certificate

Guide

  1. Build the Docker image:

    $ docker build -t integer_api .

    or, use Alpine-based image:

    $ docker build -f Dockerfile.alpine -t integer_api:alpine .

    Note: If you use Alpine-based image on aarch64-unknown-linux-musl, install libc6-compat on final stage of Dockerfile.

    RUN apk add --no-cache libc6-compat
  2. Create the Docker secrets:

    $ docker secret create postgres_password db/password.txt
    $ cat cert.pem chain.pem privkey.pem | docker secret create site.pem -
    • postgres_password
    • site.pem
  3. Deploy the application to Docker Swarm:

    $ docker swarm init
    $ docker stack deploy -c docker-compose.yml inti

Usage

API Reference

GET /members/{id}

Fetch member public information by the given member id.

Output
{
    "id": 12191765,
    "name": "inti",
    "admission_year": 19
}

GET /members/{id}/contacts

Fetch member contacts by the given member id.

Output
{
    "id": 12191234,
    "name": "inti",
    "admission_year": 19,
    "phone": "010-1234-5678",
    "email": "[email protected]"
}

Environment Variables

  • DB_HOST (optional, default: localhost)
  • DB_NAME (optional, default: integer)
  • DB_USER (required)
  • DB_PASSWORD (optional)
  • DB_PASSWORD_FILE (optional)

Note: Integer requires either DB_PASSWORD or DB_PASSWORD_FILE to be set.

License

Copyright 2021 Seungjae Park

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Integer is licensed under the Apache License 2.0.

integer's People

Contributors

astro36 avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

majecty

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.