Swing Server is an open-source Swing Chart repository written in Python language.
The application can be installed from the PyPI repository using the next command.
pip install swing-server
To run the application, you have to provide a connection to the PostgreSQL database and some folder, where uploaded archives will be stored. You also need to install the Flask framework from the PyPI repository.
pip install flask
You can configure the application using environment variables.
SECRET_KEY
Secret token for storing of the user's session. (required)DATABASE_URI
PostgreSQL database URI. (required)PUBLIC_URL
Public address where the application will be accessible. (default: http://localhost:5000)STORAGE_TYPE
There is currently only single type of the storage. (default: local)STORAGE_LOCAL_DIR
Directory where uploaded charts will be stored. (required)INIT_USER_EMAIL
E-mail of the initial user that will be created after server start-up. (default: none)INIT_USER_PASSWORD
Password of the initial user. (required)
The application can be started as a Flask server using the next command.
FLASK_APP=swing_server flask run
- GET
/status
Return current server status, and a number of created charts. - GET
/chart?query=<keyword>
Return list of all charts. If the query is specified, then filter charts by their name or description. - GET
/release?chart=<chart_name>
Return list of all releases for the specific chart. Releases are ordered by the version. - GET
/release/<chart_name>-<version>.zip
Download specific release of the chart. The filename can be for exampleredis-1.0.0.zip
. - POST
/release
Upload a new release of the chart. If the chart does not exist, then a new one is created. The archive has to be sent as a multipart form under thechart
key with theContent-Type
header set tomultipart/form-data
. - DELETE
/chart/<chart_name>?version=<version>
Remove chart both from the database and from local storage. If the version is specified, then remove only the specific release. - POST
/login
Login user using encoded credentials sent in theAuthorization
header of the request. It is used theBasic
type of authorization in this format<username>:<password>
. - POST
/logout
Log out currently logged user.
- List all uploaded charts.
- Get the detail and releases of the chart.
- Download a specific version of the chart.
- Upload a new version of the chart.
- Retrieve server status information.
- Charts should be stored in the server filesystem.
- The server can be configurable using environment variables.
- Editing of charts has to be secured by user authentication.
- New chart storage should be easily implementable.