Skip to main content

Synology Package Repository

Project description

spkrepo

Synology Package Repository

Build Discord

Development

Installation

  1. Install dependencies with poetry install
  2. Run the next commands in the virtual environment poetry shell
  3. Create the tables with python manage.py db create
  4. Populate the database with some fake packages with python manage.py db populate
  5. Add an user with python manage.py user create -u Admin -e admin@admin.adm -p adminadmin
  6. Grant the created user with Administrator permissions python manage.py user add_role -u admin@admin.adm -r admin
  7. Grant the created user with Package Administrator permissions python manage.py user add_role -u admin@admin.adm -r package_admin
  8. Grant the created user with Developer permissions python manage.py user add_role -u admin@admin.adm -r developer

To reset the environment, clean up with python manage.py clean.

Run

  1. Start the development server with python manage.py runserver
  2. Website is available at http://localhost:5000
  3. Admin interface is available at http://localhost:5000/admin
  4. NAS interface is available at http://localhost:5000/nas
  5. API is available at http://localhost:5000/api
  6. Run the test suite with poetry run pytest -v

Docker Compose Run

It is also possible to start a development environment with postgres database using docker compose:

  1. Build and run docker-compose up --build
  2. On first run you can apply database migrations with docker exec spkrepo_spkrepo_1 python manage.py db upgrade. Also run any other command that you need (populate the databse, create user) as mentioned above but by prefixing with docker exec {container_id} [...].
  3. Browse to http://localhost:5000
  4. To tear down the environment, run docker-compose down --remove

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= "simple"
# 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'

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.2.tar.gz (189.7 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.2-py3-none-any.whl (198.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spkrepo-0.2.2.tar.gz
  • Upload date:
  • Size: 189.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure

File hashes

Hashes for spkrepo-0.2.2.tar.gz
Algorithm Hash digest
SHA256 8ae0869686ddd26ae609d1806938be4f9f93c037f13f4f742cd8abb29f9dd969
MD5 beec79df3378fd97bd465095572fa3b8
BLAKE2b-256 1c196b331c014f813e59355f1aca45f41e798d8f5ef4d51fcf4a031812baca21

See more details on using hashes here.

File details

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

File metadata

  • Download URL: spkrepo-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 198.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.10 Linux/5.11.0-1028-azure

File hashes

Hashes for spkrepo-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a70bac4060bacf2f57d635becc8511ca4715d1c6b75d8a0965ee7835882919d
MD5 5e47106114cd266bce6757b81fd808f4
BLAKE2b-256 cfd9afb26ef465e7b984af931a173271a0b7a136d9b7238dccffbc6420ae783b

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