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


The following operations are complete:

The content about how to use Funcraft to migrate an application from a traditional framework is no longer maintained. We recommend that you use Serverless Devs to migrate relevant frameworks to Function Compute.

For more information about how to migrate Function Compute-related resources from Funcraft to Serverless Devs, see Migrate resources from Funcraft to Serverless Devs.

For more information about how to use Serverless Devs to migrate an application from a web framework, see Use Serverless Devs to migrate web frameworks.

We apologize for any inconvenience caused.

Background information

Beego is an HTTP framework used to efficiently develop Go applications. It is also a RESTful framework used to efficiently develop various applications, such as APIs, web applications, and backend services. Beego is inspired by Tornado, Sinatra, and Flask, and has some Go-specific features, such as interfaces and struct embedding.


  1. Run the following command to install Beego. For more information, see Beego.
    go get                    
  2. Run the following command to create a hello.go project:
    package main
    import ""
    func main(){
  3. Run the on-premises project.
    go run hello.go                    
  4. Run the fun deploy -y command to deploy the application to Function Compute.
    fun deploy -y        
    The following result is returned:
    current folder is not a fun project.
    Fun detected your application doesn't listen on '' in hello.go
    Fun will replace your addr to '', and also backup your origin file hello.go to hello.go.bak
    ? Are your sure? Yes
    Could not find any bin files from current folder.
    Before using 'fun deploy', you must use 'GOARCH=amd64 GOOS=linux go build -ldflags "-s -w"' to compile your project.
    ? Let Fun exec this command for you? Yes
    Executing command 'GOARCH=amd64 GOOS=linux go build -ldflags "-s -w"'...
    You must use 'GOARCH=amd64 GOOS=linux go build -ldflags "-s -w"' to recompile your project every time before using fun deploy.
    Generating template.yml...
    Generate Fun project successfully!
    ========= Fun will use 'fun deploy' to deploy your application to Function Compute! =========
    ...  .....   .....
                    trigger httpTrigger deploy success
            function express deploy success
    service express deploy success
    Detect 'DomainName:Auto' of custom domain 'Domain'
    Fun will reuse the temporary domain, expired at 2020-04-03 09:52:55, limited by 1000 per day.
    Waiting for custom domain Domain to be deployed...
    custom domain Domain deploy success            
    Function Compute requires the service that needs to be started to listen on port For more information, see Overview. The deployment logs indicate that Funcraft attempts to check the port that the application listens on. If the port does not meet the requirement, press the ENTER key. Then, Funcraft changes the port and detects the executable program generated by the build. If no executable program is detected, you are prompted to run the specified command to compile a project. Alternatively, you can press the ENTER key. Then, Funcraft helps you compile a project. After the project is compiled, the bootstrap and template.yml files required by Funcraft are automatically generated, and the project is automatically deployed.

    After the application is deployed, you can check the logs to find the temporary domain name that is generated by Function Compute. 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. You must use a domain name that has obtained an Internet Content Provider (ICP) filing from Alibaba Cloud for production. For more information, see Configure a custom domain name.