Coder Social home page Coder Social logo

doi-publishing-api's Introduction

doi-publishing-api

Microservice API to publish DOIs on Datacite.

View the API docs

Email

This service works in tandem with the email relay server Catapulte.

The EnviDat email microservice can be found here.

Development Usage

Environment Variables

  1. Make a file named .env in the root directory

  2. Generate the variables using env.example as a reference

  3. New environment variables must be added to:

    • env.example because this file is used for validation
    • environment section of the doi-api containers in the docker-compose.<branch>.yml files

Option 1: Docker

  1. Run the docker container:
docker compose up  -f <docker compose file> -d

The image should pull, or fallback to building.

Option 2: Standalone

  1. Install dependencies:
pip install virtualenv
python -m venv <virtual-environment-name>
   or
Create a virtual environment with PyCharm

<virtual-environment-name>\Scripts\activate
pip install -r requirements.txt
  1. Run the FastAPI server directly with PDM:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
  1. Access at: http://127.0.0.1:8000

Production Usage

  1. Configure environment variables used in production

    • Create individual CI/CD variables for each variable listed in env.example

    • APP_VERSION must be incremented so that a new image is built and the application includes the updated code

      • Create a git tag for the commit that corresponds to the APP_VERSION
    • ROOT_PATH is an optional environment variable and should only be used to if the application uses a proxy

    • Create individual CI/CD variables for each the following variables (apart from the ones in env.example) that are used for deployment:

      Key Example Value
      APP_VERSION 1.1.2
      ROOT_PATH ""
      INTERNAL_REG registry-gitlab.org.ch/orgname
      EXTERNAL_REG docker.io
      NGINX_IMG_TAG 1.25
      PYTHON_IMG_TAG 3.10
      DEPLOY_HOSTNAME server.wsl.ch
      DEPLOY_SSH_KEY encryption private key
      DEPLOY_SSH_USER test_user
  2. Merge feature/development branch to main default branch

    • The main branch has a pipeline set up in .gitlab-ci.yml that automatically deploys changes to production server
    • The pipeline also requires CI/CD variables that are used to that are used to build and register a Docker image of the application: IMAGE_REGISTRY_USER and IMAGE_REGISTRY_PASS
      • The image related variables can be group variables inherited from the parent group

Pre-commit hooks

  • To run the pre-commit hooks manually open app in terminal and execute: pre-commit run --all-files
  • These hooks ensure that the application uses standard stylistic conventions
  • To view or alter the pre-commit hooks see: .pre-commit-config.yaml

Tests

  • Tests are located in tests
  • To run tests manually open app in terminal and execute: pytest

Scripts

  • Scripts are located in the scripts directory

Authors

Ranita Pal, Swiss Federal Institute for Forest, Snow and Landscape Research WSL
Rebecca Kurup Buchholz, Swiss Federal Institute for Forest, Snow and Landscape Research WSL
Sam Woodcock, Swiss Federal Institute for Forest, Snow and Landscape Research WSL

License

MIT License

doi-publishing-api's People

Contributors

domdomhaas avatar rebeccakurupbuchholz avatar spwoodcock avatar

Watchers

 avatar  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.