Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.
/ integer Public archive

[DEPRECATED] Member Management Service

License

Notifications You must be signed in to change notification settings

int-i/integer

Repository files navigation

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@example.com"
}

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.