Managing your Wasmer Edge apps with the wasmer
CLI
Wasmer provides you with CLI commands to deploy and manage your applications on the Edge.
The most important ones are wasmer deploy
and the subcommands of wasmer app
.
Note: To deploy apps on Wasmer Edge an account is required. When deploying an app, you will be prompted to login if you are not already.
Note: This page describes in more detail the commands available in the
CLI to manage your Wasmer Edge apps. To quickly create and deploy an app,
refer to the get started guide or just
install the CLI and run wasmer deploy
.
Deploying an app (wasmer deploy
)
To deploy an app to the Wasmer Edge, the user can use the wasmer deploy
command.
$ wasmer deploy --help
Deploy an app to Wasmer Edge
Usage: wasmer deploy [OPTIONS]
Options:
--publish-package
Automatically publish the package referenced by this app.
Only works if the corresponding wasmer.toml is in the same directory.
--path <PATH>
The path to the app.yaml file
--no-wait
Do not wait for the app to become reachable
--owner <OWNER>
Specify the owner (user or namespace) of the app.
If specified via this flag, the owner will be overridden. Otherwise,
the `app.yaml` is inspected and, if there is no `owner` field in the
spec file, the user will be prompted to select the correct owner. If
no owner is found in non-interactive mode the deployment will fail.
...
The wasmer deploy
command has many flags, but does not have any mandatory
argument. Its objective is that of loading the user-provided data - thus,
possibly, publishing a package as well - in Wasmer Edge and
providing the needed informations for the user to manage their application.
Based on the kind of app the user wants to deploy, the wasmer deploy
command carries out different actions. In a nutshell, from the CLI perspective,
there are two kinds of deployment - just as mentioned above for the wasmer app create
command - which entail two different flows.
In one case the user refers to a package already existing in the registry - in
this case the package
field
in the app.yaml
file will refer to an identifier of the package (e.g.
wasmer/hello
). In the other case, when the user has a custom local package
that they want to upload and use, the package
field will contain the path to
the package's manifest.
In the latter case, the wasmer deploy
command recognizes that the user
might want to edit some of the metadata about the package and, if needed,
prompts the user to decide on that regard. One example is that of the package
version: in interactive mode, if the --bump
flag was not given, the user will
be asked if a patch version bump is needed. This, however, is not the only way
to specify the version of a package: for a deeper dive into this matter, check
out the publish
page.
Once these matters are decided upon, this deployment flow concludes just as the former: your app is available!
$ wasmer deploy
...
✔ Who should own this app? · <your-app>
✔ What should be the name of the app? · <your-app-name>
✔ What would you like to deploy? · Choose an existing package
✔ What is the name of the package? · wasmer/hello
✔ Unpacked template
✔ Do you want to deploy the app now? · yes
Deploying app <your-app-name> (<you>) to Wasmer Edge...
App <your-app-name> (<you>) was successfully deployed 🚀
https://<your-app-name>-<you>.wasmer.app
→ Unique URL: https://<app-id>.id.wasmer.app
→ Dashboard: https://wasmer.io/apps/<you>/<your-app-name>
Waiting for new deployment to become available...
(You can safely stop waiting now with CTRL-C)
.
𖥔 Deployment complete
Note: The wasmer deploy
command is a top level alias of
wasmer app deploy
: running any of the two commands will result in the execution
of the same program.
Managing your app (wasmer app
subcommand)
Once an app is deployed, the wasmer
CLI provides a number of tools to manage
it.
Gathering informations about apps (wasmer app info
and wasmer app get
)
In order to fetch structured informations about your app, you can use the
wasmer app get
, that provides the user with a number of informations about
the app structured as a YAML value, ranging from the identifier of the app to
the raw value of the app.yaml
config file used to create the app.
The wasmer app info
command provides a synthesis of these informations, in
particular the app name, the owner of the app, and relevant URLs.
$ wasmer app info
App Info
→ Name: <your-app-name>
→ Owner: <you>
→ URL: https://<your-app-name>-<you>.wasmer.app
→ Unique URL: https://<app-id>.id.wasmer.app
→ Dashboard: https://wasmer.io/apps/<you>/<your-app-name>
Both these apps have the same user-facing structure: the user can provide an
app specifier in a format such as your-name/your-app
or as the app
identifier, which is persisted in the app.yaml
file upon deploying.
Listing your apps (wasmer app list
)
In order to show all the apps linked to your account, you can use the wasmer app list
command.
Creating an app (wasmer app create
)
The Wasmer CLI allows users to intentionally create an app, but if a user runs
wasmer deploy
without an app available, the app creation process will be
triggered.
$ wasmer app create --help
Create a new Edge app
Usage: wasmer app create [OPTIONS]
Options:
-t, --type <type>
Possible values:
- http: A HTTP server
- static-website: A static website
- browser-shell: Wraps another package to run in the browser
- js-worker: Winter-js based JS-Worker
- py-application: Python worker
--deploy
Whether or not to deploy the application once it is created.
If selected, this might entail the step of publishing the package
related to the application. By default, the application is not
deployed and the package is not published.
-v, --verbose...
Generate verbose output (repeat for more verbosity)
--no-validate
Skip local schema validation
...
This subcommand offers a wide range of flags, mostly to make wasmer app create
functional as a non-interactive command as well.
In the interactive case, the user will be guided through the steps to create an
app: entering the name of the owner of the app (if not
provided via the --owner
flag) and the name of the app (if not provided via
the --name
flag).
Once the metadata about the app are available, the user must decide the kind of app they want to deploy.
$ wasmer app create
...
? What would you like to deploy? ›
Start with a template
❯ Choose an existing package
Templates allow users to kickstart their custom application from one of the
available boilerplates like a static website, a php application, a javascript
worker and much more. Another possibility is that of creating an app from an
existing package: for example, as a starting step, the user can create the app
from an existing package, like
wasmer/hello
(opens in a new tab).
$ wasmer app create
...
✔ What would you like to deploy? · Choose an existing package
✔ What is the name of the package? · wasmer/hello
The result of this action is that the CLI will create a file called app.yaml
in the current working directory:
kind: wasmer.io/App.v0
name: <YOUR-APP-NAME>
owner: <YOUR-NAME>
package: wasmer/hello
This file contains all the necessary informations required to deploy your app to Wasmer Edge. To learn more about this configuration file, refer to the dedicated Learn page. After having everything in place - whether it is from templates or pre-existing packages - the command will ask the user if they want to deploy their app.