Using Container Service to Build WeChat Applets
Abstract: WeChat applets are lightweight applications that run within the WeChat environment. WeChat applets are more flexible than public accounts because many features that are not available for WeChat public accounts are available in applets. Although applets are smaller than dedicated apps, applet developers can still profit by leveraging the large user base of WeChat attract a number of service providers. Is there a quick and convenient way for building WeChat applets?
WeChat applets are lightweight applications that run within the WeChat environment. WeChat applets are more flexible than public accounts because many features that are not available for WeChat public accounts are available in applets. Although applets are smaller than dedicated apps, applet developers can still profit by leveraging the large user base of WeChat attract a number of service providers. Is there a quick and convenient way for building WeChat applets?
If you want to develop a WeChat applet, presumably you have some previous knowledge of applets. WeChat’s applet support is mainly on the client, and the applet directory and structure on the client, with defined configuration files and available APIs. However in this Internet era, the client alone is too thin to implement many features. Currently nearly all apps have their own service clients, and the core logic is placed on the server. The client is only responsible for displaying the interface and user interaction.
Since we need a server, server deployment and O&M is inevitable. Server maintenance is tedious, whether for a novice or a veteran. It involves preparing the server, configuring the running environment, pushing the code to the server, and starting and debugging the server. The whole process is labor intensive, exaggerated with various complex issues in the middle, such as lack of dependencies and inexplicable faults. Some services are complicated and dependent on databases or other services. Additionally, you need to invest more to build a set of database and update server apps.
Alibaba Cloud Container Service
Alibaba Cloud Container Service provides a high-performance, scalable container app management service that enables you to use Docker containers for app lifecycle management. It also offers a variety of app publishing methods and continuous delivery capability, and supports the applet architecture. Container Service simplifies the establishment of cluster management through containers. It also integrates Alibaba Cloud virtualization, storage, network, and security capabilities to create the best running environment for the Docker on the cloud.
With Alibaba Cloud Container Service, you can cut down the costs for environment building and deployment. Subsequent software updates can also be done through the Container Service. You can achieve fully automatic development from code commit to service update through the DevOps support of the Container Service.
Deploying apps with Container Service is very simple, as summarized in the following steps:
- Package the app into a Docker image and push the package to an Alibaba Cloud image repository.
- Prepare the orchestration template in a YAML file, a relatively simple file format. Describe your app image, app configuration, and dependent database or other services in this file.
- Deploy new apps on Container Service.
The article Create a Python app using Redis on Alibaba Cloud Container Service provides a sample of Python Web + Redis.
At this point, we have successfully deployed an app. However, online services require constant updates. Alibaba Cloud Container Service simplifies the process of deploying updates:
- Modify the code.
- Build a new image and push it to the image repository.
- Click the link in the Container Service console to redeploy the app.
Here we need to manually build the image and open the Container Service console to redeploy the app using the new image. How can we enable instant re-deployment after code changes? The Container Service fully supports this scenario. In the article, Best practices of Docker on the cloud platform: container technology-based DevOps, the author elaborates on the deployment of a complete, continuous delivery procedure in the Container Service.
Support for HTTPS and WebSocket
WeChat applets require regular requests to access HTTPS, and implements WebSocket for persistent connections. How can we support HTTPS and WebSocket on Container Service? This is easy and described in the article, Docker DevOps practice: a WebSocket-based chat app. Because the Container Service uses the Server Load Balancer at the front-end for request forwarding, you can access the service through HTTPS as long as you have configured the required certificate on the Server Load Balancer.