Skip to content

Tools

aeppic includes a few tools to get started.

@aeppic/install-server

The install-server tool can be used to install aeppic-server from a repository server like https://get.aeppic.com or update the base dataset.

This is mostly used for standalone installations via ansible or manually. Alternatively docker images are located at registry.dev.curasystems.com.

README.md
md
# Usage

npx @aeppic/install-server
Usage
txt
npx @aeppic/install-server [version]

Installs an instance of @aeppic/server with [version]

Positionals:
  version  The version of @aeppic/server to install (e.g `latest`, `beta`,
           `3.6.0`, `^3.6.1`)                                [default: "stable"]

Options:
  -j, --json                     Log using json parsable output        [boolean]
  -v, --verbose                  Output all events                     [boolean]
      --help                     Show help                             [boolean]
  -s, --server                   The url of the image server (can be an absolute
                                 path to a local folder too) to download server
                                 image from  [default: "https://get.aeppic.com"]
  -n, --node-bin                 Explicitly define the path to the node binary
                                 to use. By default it uses the currently active
                                 node binary
      --data-only                Only install data, do not install the server
                                                                       [boolean]
      --data-version             The version of the data to install. If not
                                 specified no data will be installed (e.g
                                 `latest`, `2022-11-22T13-48-32.534Z`)
      --data-no-upgrade          Do not upgrade data if a system file is already
                                 installed                             [boolean]
      --install-dir              Default install directory
                                                 [default: "/opt/aeppic/server"]
      --data-dir                 Data location to be used by the server
                                                   [default: "/opt/aeppic/data"]
      --port                     HTTP Port to be used     [number] [default: 80]
      --config                   Path to configuration to use. If parameters
                                 such as port are defined it will be modified to
                                 fit the arguments
      --listen                   IP Addresses the server should listen to[array]
      --service                  Install as service (supported on Unix with
                                 systemd/systemctl only). It is NOT auto-enabled
                                 or started                            [boolean]
      --instanceId               Instance Id to be used for installation
                                                      [default: "aeppic-server"]
      --token, --download-token  Download token for accessing the download
                                 server. Without a download token no downloads
                                 are possible. Uses env variable
                                 AEPPIC_DOWNLOAD_TOKEN or AEPPIC_TOKEN by
                                 default
      --overwrite                Overwrite existing local installation.[boolean]

@aeppic/install-repository-server

The install-repository-server tool can be used to install a repository server to be used by @aeppic/install-server.

README.md
md
# 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. `my-package@1.0.2.tgz`.

> 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.
Usage
txt