---
# System prepended metadata

title: Run API + Registry locally

---

# Run API + Registry locally

## Registry

`config.secret.json`
```diff
 35 ⋮    │  "PG_DATABASE": "postgres://localhost:5432/snykregistry",
    ⋮ 35 │  "PG_DATABASE": "postgres://postgres:b57ddf9396c64639@localhost:5432/snykregistry",

 96 ⋮ 96 │  "AUTHORIZATION_SERVICE": {
 97 ⋮    │    "secret": "ZGVmYXVsdC1zaGFyZWQtc2VjcmV0Cg=="
    ⋮ 97 │    "secret": "CKz+PmQNRcncxS/VQUzJyNS8y6I/LE2YLeaN8VfybzE="
 98 ⋮ 98 │  }
```


`config.local.json`
```json
{
  "REGISTRY_WORKER_INTERNAL_HOST": "http://localhost:8000",
  "GITHUB_AGENT_URL": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@github-agent.dev.snyk.io",
  "//* GITHUB_AGENT_URL": "http://localhost:27000",
  "CSV_SERVICE": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@csv-service.dev.snyk.io",
  "//* CSV_SERVICE": "http://localhost:26000",
  "REPORTING": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@reporting.dev.snyk.io",
  "//* REPORTING": "http://localhost:25000",
  "PG_DATABASE": "postgres://postgres:b57ddf9396c64639@localhost:5432/snykregistry",
  "REDIS_CACHE_URL": "redis://localhost/",
  "IMPORT_REDIS_URL": "redis://localhost/5",
  "REDIS_AGENTS_CLIENT_URL": "redis://localhost/2",
  "PROJECT_RECURRING_TEST_JOBS": {
    "redisCacheUrl": "redis://localhost/4"
  },
  "INTERNAL_API": {
    "enabled": true,
    "secret": "CKz+PmQNRcncxS/VQUzJyNS8y6I/LE2YLeaN8VfybzE="
  },
  "GLOBAL_SOURCES": {
    "gitlab": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@gitlab-agent.dev.snyk.io",
      "//* uri": "http://localhost:26000"
    },
    "aws-lambda": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@aws-lambda-agent.dev.snyk.io",
      "//* uri": "http://localhost:19000"
    },
    "azure-functions": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@azure-functions-agent.dev.snyk.io"
    },
    "azure-repos": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@azure-repos-agent.dev.snyk.io"
    },
    "bitbucket-server": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@bitbucket-server-agent.dev.snyk.io",
      "//* uri": "http://localhost:22000"
    },
    "bitbucket-cloud": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@bitbucket-cloud-agent.dev.snyk.io"
    },
    "github-enterprise": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@ghe-agent.dev.snyk.io"
    },
    "cloud-foundry": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@loud-foundry-agent.dev.snyk.io"
    },
    "pivotal": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@pivotal-agent.dev.snyk.io"
    },
    "ibm-cloud": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@bluemix-agent.dev.snyk.io"
    },
    "docker-hub": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@docker-registry-agent.dev.snyk.io"
    },
    "ecr": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@docker-registry-agent.dev.snyk.io"
    },
    "acr": {
      "uri": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@docker-registry-agent.dev.snyk.io"
    }
  },
  "PACKAGE_ORACLE": {
    "url": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@package-oracle.dev.snyk.io",
    "//* url": "http://localhost:24000"
  },
  "//* GO_DEPS_URL": "http://localhost:17300",
  "PHOENIX": {
    "url": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@phoenix.dev.snyk.io",
    "//* url": "http://localhost:9000",
    "reqTimeoutMs": 300000,
    "reqRetries": 3,
    "reqRetrySleepMs": 500
  },
  "DEEPCODE": {
    "newUrl": "https://api.deepcoded.com",
    "endpoint": "https://${SNYK_INTERNAL_PROXY_CREDENTIALS}@code-infra-codeapi.dev.snyk.io"
  },
  "AUTHENTICATION_SERVICE": {
    "hostname": "http://localhost:3846"
  },
  "SALESFORCE": {
    "enabled": false
  },
  "AUTH0_MANAGEMENT": {
    "domain": "snyk-local.auth0.com",
    "clientId": "cWAMuBvjPEeJb8YjpBXIpxbs1HR63N3N",
    "clientSecret": "<Redacted, Go get it from https://manage.auth0.com/dashboard/us/snyk-local/applications/cWAMuBvjPEeJb8YjpBXIpxbs1HR63N3N/settings>",
    "audience": "https://snyk-local.auth0.com/api/v2/",
    "registryAppClientId": "LCfhHqdB3ZGZzbulGREt6EqhSjNopmXn",
    "enabledConnectionClients": [
      "LCfhHqdB3ZGZzbulGREt6EqhSjNopmXn"
    ]
  },
  "LOGGING": {
    "name": "dev-registry",
    "level": "debug",
    "requests": true,
    "muteKeys": [],
    "sensitiveKeys": []
  },
  "AUTHORIZATION_SERVICE": {
    "enabled": true,
    "secret": "CKz+PmQNRcncxS/VQUzJyNS8y6I/LE2YLeaN8VfybzE="
  },
  "API_GATEWAY_VERIFICATION_KEYS": {
		"ea2f9fee-a5ef-4676-ab05-b3d4cfbc318f": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqAe+5dlyxMKeK05RqFOP\nrT/JsVom/niWHd8Qmj7xDJg0Cpv5jjFumR6TAU/JVxV7YApylE1npqE3R6wfavhF\nmPeK8nx3NnpSsMk31baSr1h+VhhZlX9EhdtOacPv3MzmChqqarMMaH6AjPUkIaAe\nhE9g6pORfqALlfpazcnAJyPfNcZB9KpCNdWdPhbTElfhfICtHY1VRVc/KDd4Pua7\nsQuLxBCSgIWvKkRrDAkb/ERhNScFEOK8SRtNMyPm7iQc4cral9+DJEDleErUwqGF\nsaEk61YuySLUfi1PmKx9Oc5UNEWEX0XPSLTlACmsqmbguXOGuctHwjzJIVTCON67\naQIDAQAB\n-----END PUBLIC KEY-----"
	}
}
```

# Cloud API

config.dev.json
```
{
  "listenAddr": ":8080",
  "useOpenAPIValidator": false,
  "orgAPI": {
    "baseUrl": "http://host.docker.internal:8000/api/internal",
    "version": "2022-02-11~experimental"
  },
  "migrationsPath": "/migrations",
  "postgresDbUrl": "postgres://postgres:b57ddf9396c64639@host.docker.internal:5432/cloud?sslmode=disable"
}
```

docker-compose-db.yaml
```
version: "3.1"

services:
  postgres_db:
    container_name: postgres_db
    build:
      context: .
      dockerfile: Dockerfile.db
    environment:
      POSTGRES_USER: ${CLOUD_DB_ROOT_USERNAME}
      POSTGRES_PASSWORD: ${CLOUD_DB_ROOT_PASSWORD}
      POSTGRES_DB: ${CLOUD_DB_NAME}
    ports:
      - 5432:5432
    command: -c ssl=on -c ssl_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem -c ssl_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
    volumes:
      - ./volumes/postgresql:/var/lib/postgresql
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${CLOUD_DB_ROOT_USERNAME}"]
      interval: 5s
      timeout: 5s
      retries: 12

  redis:
    image: redis:alpine3.16
    ports:
      - 6379:6379
    volumes:
      - ./volumes/redis:/data
```

helm/values/local.yaml

```
polaris-ingress:
  enabled: false

postgres:
  enabled: false

polarisPostgres:
  enabled: false

cerberus:
  config:
    logger:
      level: trace
      output: pretty
    filters:
      request:
        authz:
          client:
            baseUrl: "http://host.docker.internal:8000/api/internal/authz"
            tokenPath: "/etc/secrets/authorization-service-secret"
            tokenType: "Bearer"
            version: "2021-07-19~experimental"
```

