Go to website console.zhonghuacloud.com:
- Zip your existing source code files and folders.
- Click the Move to Serverless button
- Enter your own domain name which is a dns cname record with the value of host.us.zhonghuacloud.com or you can choose a free sub domain name pattern with xxx.v.zhonghuacloud.com such as abc.v.zhonghuacloud.com
- Choose the language of your program(NodeJS/Python).
- Choose whether you want to have a free MySQL database or not.
- Choose your program is stateful or stateless. (if Your program using server side memory such as http session, then you should choose stateful otherwise choose stateless.)
- Click the create website button.
- Go to created website and upload the zipped source files.
- Click the NPM install / pip install link to build the runtime environment.
- Click the startup link to start up your website.(Default there are 2 server instance each website)
- (The most valuable feature)Click the scale button to increase or decrease the number of website instances.
- Caveats:
- All instances of your website sharing one filesystem, so your progarm can always save data into the local filesystem safely.
- If your website is stateful, the http requests from same customer always hit same website instance safely.
- If your website is stateless, the http requests will be load balanced to different website instances.
- Your website should listen on the port number 9000. The public traffic will be only forwarded to port number 9000.
- The NodeJS program will be booted from the package.json start script, which is from the command npm start
- The python program will be started from a shell script named ‘startup.sh’ which is generated by platform. You are free to change the content of the shell scrcipt as you wanted.
- You can alway access your mysql database by clicking the link which points to a mysql adminer.php program.
- If your program is created with a free MySQL database. The Database connection information can be read from following env variables. This is an example code of NodeJS:
var env = process.env;
var dbo = {
host: env[‘bebox_mysql_host’], port: env[‘bebox_mysql_port’],
user: env[‘bebox_mysql_user’],
password: env[‘bebox_mysql_password’],
database: env[‘bebox_mysql_database’]
};
Any Issue please contact Jay.