This topic describes how to deploy a Hacker News application to Function Compute. Function Compute provides a method different from traditional deployment methods. You can deploy a traditional Hacker News application to Function Compute and use the application for production without performing steps such as purchasing a machine. Your Hacker News application can use the auto-scaling, pay-as-you-go, and O&M-free features of Function Compute.

Step 1: Prepare the environment

You do not need to install Docker but only Funcraft. The easiest way to install Funcraft is to download the executable binary files.

  1. Install Funcraft. For more information, see Install Funcraft.
  2. Run the fun --version command to check whether the installation is successful.
  3. Configure Funcraft. For more information, see Configure Funcraft.

Step 2: Migrate the application

  1. Run the following command to clone the Hacker News sample project to your local machine. If you already have a Hacker News project, skip this step.
    git clone                       
  2. Run the following command to open the sample application or an existing application:
    cd hackernews                        
  3. Run the following command to install dependencies:
    npm install                        
  4. Run the following command to run the on-premises application:
    npm run dev                    
  5. Run the following command to compile the Hacker News project:
    npm run build                   
  6. Run the fun deploy -y command to deploy the application to Function Compute.
    fun deploy -y
    The following results are returned:
    current folder is not a fun project.
    Generating /Users/XXX/Desktop/hackernews/bootstrap...
    Generating template.yml...
    Generate Fun project successfully!
    ========= Fun will use 'fun deploy' to deploy your application to Function Compute! =========
    ...  ...  ...
    Fun detected that your function hackernews/hackernews sizes exceed 50M. It is recommended that using the nas service to manage your function dependencies.
    ? Do you want to let fun to help you automate the configuration? Yes
    ? We recommend using the 'NasConfig: Auto' configuration to manage your function dependencies.
    ...  ...  ...
    starting upload /Users/XXX/Desktop/hackernews/node_modules to nas://hackernews/mnt/auto/node_modules/
    start fun nas init...
    ...  ...  ...
                trigger httpTrigger deploy success
        function hackernews deploy success
    service hackernews deploy success
    Detect 'DomainName:Auto' of custom domain 'Domain'
    Request a new temporary domain ...
    The assigned temporary domain is, expired at 2020-04-02 13:51:57, limited by 1000 per day.
    Waiting for custom domain Domain to be deployed...
    custom domain Domain deploy success

    The size of a code package uploaded to Function Compute cannot exceed 50 MB. If Funcraft detects that your code package exceeds this limit, it starts the large dependency wizard. In the wizard, enter Y and Funcraft will automatically upload the third-party dependencies in your function to Apsara File Storage NAS.

    After the application is deployed, you can check the logs to find the temporary domain name that Function Compute generated. You can use this temporary domain name to access the deployed application.

    Note The temporary domain name is used only for demonstration and development purposes. It is valid for a limited period of time. To use an application in a production environment, you must bind the application to a domain name that has obtained an Internet Content Provider (ICP) filing from Alibaba Cloud. For more information, see Bind a custom domain name.