Synology Package Repository
Project description
spkrepo
Synology Package Repository
Development
Installation
- Install dependencies with
poetry install - Run the next commands in the virtual environment
poetry shell - Create the tables with
python manage.py db create - Populate the database with some fake packages with
python manage.py db populate - Add an user with
python manage.py user create -u Admin -e admin@admin.adm -p adminadmin - Grant the created user with Administrator permissions
python manage.py user add_role -u admin@admin.adm -r admin - Grant the created user with Package Administrator permissions
python manage.py user add_role -u admin@admin.adm -r package_admin - 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
- Start the development server with
python manage.py runserver - 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
poetry run pytest -v
Docker Compose Run
It is also possible to start a development environment with postgres database using docker compose:
- Build and run
docker-compose up --build - 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 withdocker exec {container_id} [...]. - Browse to http://localhost:5000
- 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
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.1.tar.gz.
File metadata
- Download URL: spkrepo-0.2.1.tar.gz
- Upload date:
- Size: 189.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
90b74c778fd766c683c7ab473d86785f31265dcee16752f51a66136fb7b64895
|
|
| MD5 |
7c9d299f1568e8ba697236d294dbec00
|
|
| BLAKE2b-256 |
e330b69fdce43ec3f6fb3f016198a2ebed74ccaa320512a01b29d620c605dbac
|
File details
Details for the file spkrepo-0.2.1-py3-none-any.whl.
File metadata
- Download URL: spkrepo-0.2.1-py3-none-any.whl
- Upload date:
- Size: 198.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.11.0-1025-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
138d35ebfa378de12913806f981b88c7d09a1347f165269125aeb86016d08645
|
|
| MD5 |
d94d01a52a788bb2c42f789ebb8609bf
|
|
| BLAKE2b-256 |
5010eb9a0f5a07078d510dd410e0cbc4dd6607d68f11bd4fe0bf3a44c2708c8d
|