Learning Appfile Step by Step
In this tutorial, we will build and deploy an example NodeJS app under examples/testapp/.
- installed on the host
- KubeVela installed and configured
git clone and go to the testapp directory:
The example contains NodeJS app code, Dockerfile to build the app.
In the directory there is a which follows Appfile format supported by Vela. We are going to use it to build and deploy the app.
image: oamdev/testapp:v1 # change this to your image
$ vela up
Parsing vela.yaml ...
Loading templates ...
Building service (express-server)...
Sending build context to Docker daemon 71.68kB
Step 1/10 : FROM mhart/alpine-node:12
---> 9d88359808c3
pushing image (oamdev/testapp:v1)...
...
Writing deploy config to (.vela/deploy.yaml)
Applying deploy configs ...
Checking if app has been deployed...
App has not been deployed, creating a new deployment...
✅ App has been deployed 🚀🚀🚀
Port forward: vela port-forward testapp
SSH: vela exec testapp
Logging: vela logs testapp
App status: vela status testapp
Service status: vela status testapp --svc express-server
Check the status of the service:
If 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
:
build:
push:
docker:
file: Dockerfile
context: .
Then deploy the app to kind:
$ vela up
(Advanced) Check rendered manifests
By now we have deployed a , which is the default workload type in KubeVela. We can also add another service of Task type in the same app:
services:
pi:
type: task
image: perl
cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
express-server:
...
Then deploy Appfile again to update the application:
$ vela up
Interested in the more details of Appfile?
Congratulations! You have just deployed an app using Vela.
Some tips that you can have more play with your app: