Updated on 2025-12-10 GMT+08:00

Step 2: Host Function Code

  1. On the function project page, choose Code > Repo in the navigation pane on the left and click Create Repository.
  2. Set Repository Type to Custom and click Next.
  3. Set Repository Name to functions, retain the default values for other parameters, and click OK.
  4. Go to the functions repository. Create a deploy directory for storing the deploy.py code of the function.
    Figure 1 Creating a directory

    The deploy.py script will read the function configuration file cam.yaml and construct an hcloud command to update the function code and configuration. For details about the configurations in cam.yaml, see Analyzing cam.yaml. Logs generated when executing this script will be recorded in the /home/function/deploy/function.log file.

  5. Create another directory named helloworld, with a complete structure.
    Figure 2 Complete function directory structure
    • helloworld: the helloworld function
    • cam.yaml: the configuration file
    • code: function code directory, which stores the index.py file