-
Notifications
You must be signed in to change notification settings - Fork 93
ngrest script
ngrest script is intended to make development of services easy.
Usually you start ngrest script with arguments to create and test services, add packages, and keep ngrest and packages up to date.
To get list of supported arguments type:
ngrest help
If there any packages installed you will see help from it.
To get full help of particular command add it's name after 'help' argument, for example:
ngrest help run
Please note, not all commands supported on any OS. All commands supported under Linux only.
Usage: ngrest [help] [<command>] [<arguments>]
Command | Description |
---|---|
help | Display help for the command. |
create | Create a new project. |
run | (default) Build and run current project in local deployment mode. |
build | Build current project. |
clean | Clean build and program cache. |
add | Add a new package into current project. |
remove | Remove a package from current project. |
packages | List packages used by current project. |
upgrade | Upgrade ngrest to the latest available version. |
upgrade-package | Upgrade packages to the latest available version. |
bundle-server | Create ngrest server bundle to install it to another host. |
deploy-server | Deploy local version of ngrest server to remote host. |
bundle | Create bundle of the current project to install it to another host. |
deploy | Deploy local version of the current project to remote host. |
Usage: ngrest create [<project_name>] <service_name> [<service_name>...]
Create a new project with one or more services.
Service name may optionally contain package name.
Example 1. Create service calculator which is bound to "/calculator" resource:
ngrest create calculator
Example 2. Create service calculator which is bound to "/ngrest/example/calculator" resource:
ngrest create ngrest.example.calculator
Example 3. Create service calculator which is bound to "/ngrest/example/calculator" resource and set project name to "calc":
ngrest create calc ngrest.example.calculator
Usage: ngrest [run]
Build and run your project in local deployment mode.
Must start in project's dir, i.e. current directory must contain '.ngrest' subdirectory and service(s) subdirectories.
There a set of environment variables to control the build process and the server:
Environment Variable | Description |
---|---|
NGREST_SERVER_PORT | Sets port which server should listen for incoming connections (default: 9098). |
NGREST_SERVER_IP | Sets IPv4 or IPv6 address which server should listen for incoming connections (default - all available). |
NGREST_LOG_LEVEL | Sets log level. Supported values are: ALERT CRIT ERROR WARNING NOTICE INFO DEBUG VERBOSE TRACE |
NGREST_LOG_VERBOSITY | Sets log verbosity. This variable is a combination of values such as: TEXT LEVEL FILELINE FUNCTION DATETIME DEFAULT ALL |
CMAKE_FLAGS | Sets CMAKE arguments used to build your project. |
MAKE_FLAGS | Sets MAKE arguments used to build your project. |
Example 1. Start your project enabling all log messages:
NGREST_LOG_LEVEL=TRACE NGREST_LOG_VERBOSITY=ALL ngrest
Example 2. Start your project and set server's port to 9090:
NGREST_SERVER_PORT=9090 ngrest
Usage: ngrest build
Build current project and create service binaries in '.ngrest/local/build/services'.
Usage: ngrest clean
Clean build and program caches.
Useful when you change CMAKE/MAKE flags or prepairing to create source tarball.
Usage: ngrest upgrade [<commit_hash>]
Upgrades ngrest to the latest available version on github. Upgrades to specific commit if provided.
Example 1. Upgrade to latest available version:
ngrest upgrade
Example 2. Upgrade to commit 2092ea0...:
ngrest upgrade 2092ea0
Usage: ngrest bundle-server [<archive_name_noext>]
Create ngrest server bundle to install it to another host.
Uses 'archive_name_noext' as filename for output archive.
Usage: ngrest bundle [<archive_name_noext>]
Create bundle of the current project to install it to another host.
Uses 'archive_name_noext' as filename for output archive.
Usage: ngrest deploy [user@]host [server_path]
Deploy local version of the current project to remote host.
ngrest server must be installed on server_path.
By default server_path = /opt/ngrest.
Example:
ngrest deploy 192.168.0.1
Usage: ngrest add <package_name> [args]
Add a new ngrest extension package to the current project.
'package_name' is formed from github url removing "http://github.com/".
'args' are arguments passed to package.
For example to add "https://github.com/loentar/ngrest-db" package with SQLite driver use:
ngrest add loentar/ngrest-db sqlite
Usage: ngrest remove <package_name>
Remove a package from current project.
'package_name' is the same as in "ngrest install".
Usage: ngrest packages
List packages used by current project. Packages are printed with version numbers.
Usage: ngrest upgrade-package [<package_name> [<package_version>]] | [--all]
Upgrade selected package to specific version.
If <package_version>
is omitted package will be upgraded to the last available version.
if argument --all is passed, all packages will be upgraded to the last available version.