Learning Appfile
A sample Appfile
is as below:
Under the hood, Appfile
will build the image from source code, and then generate Application
resource with the image name.
#
SchemaBefore learning about Appfile's detailed schema, we recommend you to get familiar with core concepts in KubeVela.
To learn about how to set the properties of specific workload type or trait, please use
vela show <TYPE | TRAIT>
.
#
Example WorkflowIn the following workflow, we will build and deploy an example NodeJS app under examples/testapp/.
#
Prerequisites#
1. Download test app codegit clone and go to the testapp directory:
The example contains NodeJS app code, Dockerfile to build the app.
#
2. Deploy app in one commandIn the directory there is a vela.yaml which follows Appfile format supported by Vela. We are going to use it to build and deploy the app.
NOTE: please change
oamdev
to your own registry account so you can push. Or, you could try the alternative approach inLocal testing without pushing image remotely
section.
Run the following command:
Check the status of the service:
#
Alternative: Local testing without pushing image remotelyIf you have local kind cluster running, you may try the local push option. No remote container registry is needed in this case.
Add local option to build
:
Then deploy the app to kind:
(Advanced) Check rendered manifests
By default, Vela renders the final manifests in .vela/deploy.yaml
:
#
[Optional] Configure another workload typeBy now we have deployed a Web Service, which is the default workload type in KubeVela. We can also add another service of Task type in the same app:
Then deploy Appfile again to update the application:
Congratulations! You have just deployed an app using Appfile
.
#
What's Next?Play more with your app: