@aeppic/install-repository-server
v3.44.0
Published
This module installs a simple web server to host binary files.
Downloads
354
Readme
Intro
@aeppic/install-repository-server
installs the a repository server to host binary files compatible with @aeppic/install-server
It automatically registers (installs) the service as a SystemD service under /etc/systemd/system
but does not enable or start it yet.
It is as simple as possible, directly contained in this module, and just copies itself to the install location. An install requires the service to not already run, existing data never gets touched.
Installing a custom repository server is only required when running accessing the curasystems registry is not possible.
Uploaded files should follow the naming convention <PACKAGE_NAME>@<VERSION>.tgz
.
Security
Upload and Download is only possible if the correct token is available. These are stored in JSON files see below.
API
Launch example server
- PORT=8881
- DATA_PATH=test
- UPLOAD_TOKENS=upload.json
- DOWNLOAD_TOKENS=download.json
node server.js
Upload a new file
<filepath>
equals a path to a packaged file <PACKAGE_NAME>@<VERSION>.tgz
. E.g. [email protected]
.
Note: The path can include directories, but only the filename is used in the uploaded name.
curl -XPOST -H "Authorization: Bearer <TOKEN_FROM_UPLOAD_TOKENS_JSON>" --form file=@<filepath> http://localhost:8881
Download
curl -H "Authorization: Bearer <TOKEN_FROM_DOWNLOAD_TOKEN_JSON>" http://localhost:8881/<filename>
Tag a file
<tagname>
is the name of the tag to use. It is a string with at least 3 characters and starting with a letter
curl -XPOST -H "Authorization: Bearer <TOKEN_FROM_UPLOAD_TOKENS_JSON>" http://localhost:8881/<filename>/tags/<tagname>
List all known files
curl -H "Authorization: Bearer <TOKEN_FROM_DOWNLOAD_TOKEN_JSON>" http://localhost:8881/
Which returns a json with all known files and dirs in the data folder. This list includes the uploaded files
as well as uploaded tags. The tags are named <PACKAGE_NAME>@<TAG>
and contain the name of the file it points to.