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.

    1. image: oamdev/testapp:v1 # change this to your image
    1. $ vela up
    2. Parsing vela.yaml ...
    3. Loading templates ...
    4. Building service (express-server)...
    5. Sending build context to Docker daemon 71.68kB
    6. Step 1/10 : FROM mhart/alpine-node:12
    7. ---> 9d88359808c3
    8. pushing image (oamdev/testapp:v1)...
    9. ...
    10. Writing deploy config to (.vela/deploy.yaml)
    11. Applying deploy configs ...
    12. Checking if app has been deployed...
    13. App has not been deployed, creating a new deployment...
    14. App has been deployed 🚀🚀🚀
    15. Port forward: vela port-forward testapp
    16. SSH: vela exec testapp
    17. Logging: vela logs testapp
    18. App status: vela status testapp
    19. 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:

    1. build:
    2. push:
    3. docker:
    4. file: Dockerfile
    5. context: .

    Then deploy the app to kind:

    1. $ 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:

    1. services:
    2. pi:
    3. type: task
    4. image: perl
    5. cmd: ["perl", "-Mbignum=bpi", "-wle", "print bpi(2000)"]
    6. express-server:
    7. ...

    Then deploy Appfile again to update the application:

    1. $ 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: