Synology Package Repository
Project description
spkrepo
Synology Package Repository
Development
Requirements
- Install docker and docker-compose
- Install python and poetry
- Optionally install direnv and a working poetry layout as described here in your
~/.config/direnv/direnvrc
Installation
- Run postgres, e.g. using docker with
docker compose up db - Install dependencies with
poetry install - Run the next commands in the virtual environment
poetry shell - Create the tables with
flask db upgrade - Populate the database with some fake packages with
flask spkrepo populate_db - Add a user with
flask spkrepo create_user -u admin -e admin@synocommunity.com -p adminadmin - Grant the created user with Administrator permissions
flask roles add admin@synocommunity.com admin - Grant the created user with Package Administrator permissions
flask roles add admin@synocommunity.com package_admin - 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
- Start postgres with
docker compose up db - Start the development server with
flask run - Website is available at http://localhost:5000
- Admin interface is available at http://localhost:5000/admin
- NAS interface is available at http://localhost:5000/nas
- API is available at http://localhost:5000/api
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spkrepo-0.2.4.tar.gz.
File metadata
- Download URL: spkrepo-0.2.4.tar.gz
- Upload date:
- Size: 190.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09bcf9611bddff0a6ec0cbb52c2afaf40b779f2424bc5180189c56e25e304910
|
|
| MD5 |
f27e6a55d0210146f6aeb89406a6cba8
|
|
| BLAKE2b-256 |
48e1a8452f97fdaca871a8738b2d0554f81773269812e2026c67f6ec91c425f4
|
File details
Details for the file spkrepo-0.2.4-py3-none-any.whl.
File metadata
- Download URL: spkrepo-0.2.4-py3-none-any.whl
- Upload date:
- Size: 199.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.7 Linux/6.2.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf82b01349259fcc55adb58435a9b42910cf19cd1e4097d4af3c9b7153d7cdef
|
|
| MD5 |
57be71ec9c2383af81210a29a9e0fc82
|
|
| BLAKE2b-256 |
87e49e7a480786e309b788108c26234e87a367ba91376de28e8a683386ec3125
|