Skip to content

Installation

Manabu Niseki edited this page Apr 7, 2024 · 5 revisions

Requirements

  • Elasticsearch v8
  • Redis v7
  • Python 3.11

Installation

Docker Compose

You can setup this project through Docker Compose.

$ git clone https://github.com/ninoseki/mihama
$ cd mihama

$ cp .env.sample .env
# change key-values if you want
$ vim .env

# the app app will be available on localhost:{PORT}
$ docker compose up -d

Manual Setup

You can run the backend API and the job queue by:

$ git clone https://github.com/ninoseki/mihama
$ cd mihama

# install Python dependencies
$ poetry install

# run the backend API
$ poetery run gunicorn -k uvicorn.workers.UvicornWorker mihama.main:app

# run the job queue
$ poetery run arq mihama.arq.worker.ArqWorkerSettings

Note that you need to have Elasticsearch and Redis up and running.

Configuration

OSV

Name Desc. Type Default
OSV_BUCKET_BASE_URL OSV bucket base URL str https://osv-vulnerabilities.storage.googleapis.com
OSV_ECOSYSTEMS OSV ecosystems CommaSeparatedStrings https://osv-vulnerabilities.storage.googleapis.com/ecosystems.txt
OSV_BUCKET_TIMEOUT Seconds to wait for downloading file int 180
ENABLE_OSSF_MALICIOUS_PACKAGES Whether to ingest OSSF malicious packages bool True

Elasticsearch

Name Desc. Type Default
ES_HOSTS Elasticsearch hosts CommaSeparatedStrings http://localhost:9200
ES_USERNAME Elasticsearch username str elastic
ES_PASSWORD Elasticsearch password str changeme
ES_INDEX Elasticsearch index to use str mihama-v{VERSION}

ARQ/Redis

Name Desc. Type Default
REDIS_URL Redis database URL DatabaseURL redis://localhost:6739
ARQ_CRON_JOBS_RUN_AT_START_UP Whether to run the cron job at start up bool True
ARQ_CRON_JOBS_HOUR hour(s) to run the cronjob on, 0 - 23 CommaSeparatedStrings 0
ARQ_CRON_JOBS_MINUTE minute(s) to run the job on, 0 - 59 CommaSeparatedStrings 0