Skip to main content

Synology Package Repository

Project description

spkrepo

Synology Package Repository

Build Discord

Development

Requirements

  1. Install docker and docker-compose
  2. Install python and poetry
  3. Optionally install direnv and a working poetry layout as described here in your ~/.config/direnv/direnvrc

Installation

  1. Run postgres, e.g. using docker with docker compose up db
  2. Install dependencies with poetry install
  3. Run the next commands in the virtual environment poetry shell
  4. Create the tables with flask db upgrade
  5. Populate the database with some fake packages with flask spkrepo populate_db
  6. Add a user with flask spkrepo create_user -u admin -e admin@synocommunity.com -p adminadmin
  7. Grant the created user with Administrator permissions flask roles add admin@synocommunity.com admin
  8. Grant the created user with Package Administrator permissions flask roles add admin@synocommunity.com package_admin
  9. Grant the created user with Developer permissions flask roles add admin@synocommunity.com developer

To clean data created by fake packages, run flask spkrepo depopulate_db

Run

  1. Start postgres with docker compose up db
  2. Start the development server with flask run
  3. Website is available at http://localhost:5000
  4. Admin interface is available at http://localhost:5000/admin
  5. NAS interface is available at http://localhost:5000/nas
  6. API is available at http://localhost:5000/api
  7. Run the test suite with pytest -v

Docker Compose Run

  • If you also want to run the app in docker you can with docker compose up app
  • You can run both postgres and the app with docker compose up

Deployment

Configuration

Create a config file ./config.py to disable debug logs, connect to a database, set a secure key and optionally set a cache:

Use LC_CTYPE=C tr -cd '[:print:]' < /dev/urandom | head -c 64 or base64 < /dev/urandom | head -c 64 to get a random string

DEBUG = False
TESTING = False
SECRET_KEY = "Please-change-me-to-some-random-string"
SQLALCHEMY_ECHO = False
SQLALCHEMY_DATABASE_URI = "postgresql://user:pass@localhost/dbname"
# https://pythonhosted.org/Flask-Caching/#configuring-flask-caching
CACHE_TYPE= "SimpleCache"
# For signing packages
GNUPG_PATH= "/usr/local/bin/gpg"

Docker

Example usage:

docker run -it --rm --name spkrepo -v $(pwd)/data:/data -p 8000:8000 ghcr.io/synocommunity/spkrepo

Additional configuration can be mounted in the container and loaded by putting the path into SPKREPO_CONFIG environment variable.

e.g.

docker run -it --rm --name spkrepo -v $(pwd)/data:/data -v $(pwd)/docker-config.py:/docker-config.py -e SPKREPO_CONFIG=/docker-config.py -p 8000:8000 ghcr.io/synocommunity/spkrepo

Serve app via a WSGI server.

Example:

pip install gunicorn
SPKREPO_CONFIG="$PWD/config.py" gunicorn -w 4 'wsgi:app'

Add migration

cd migrations/
alembic revision -m "update build path length"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spkrepo-0.2.8.tar.gz (190.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spkrepo-0.2.8-py3-none-any.whl (200.7 kB view details)

Uploaded Python 3

File details

Details for the file spkrepo-0.2.8.tar.gz.

File metadata

  • Download URL: spkrepo-0.2.8.tar.gz
  • Upload date:
  • Size: 190.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure

File hashes

Hashes for spkrepo-0.2.8.tar.gz
Algorithm Hash digest
SHA256 5653fa2e70a89e1a828f265c4b35acefcc03e2a916d1f43bebf21d79ca715244
MD5 a2e2fad656f1033819fbc6b2d55b43a6
BLAKE2b-256 d77bf334608be40d47ebb5fc837770854387de046ee9fc2413653f0da16e8305

See more details on using hashes here.

File details

Details for the file spkrepo-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: spkrepo-0.2.8-py3-none-any.whl
  • Upload date:
  • Size: 200.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.11.0-1014-azure

File hashes

Hashes for spkrepo-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 f8602a709e2615ef746088db3c30b77c6c9451770bdd4652ce4c9f82165077f3
MD5 b950a475b6d7996a8618f37666606ac6
BLAKE2b-256 51b09316de4fd78c45539a2ae0bec0a56035d02d99dcc5dce23c7cc22875c2b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page