Step by step, following the numbers
- Build your image and push it to a registry, then deploy. Each deploy is saved as a revision, and you can roll back on the Revisions tab.
- Users call your app at
https://name.containers.region.thailandhosting.com. The entry checks whether it’s open to the internet or only inside the VPC, and whether an Invoker token is needed. - Each request goes to the ready instance with the fewest requests in progress. When instances get busy (requests waiting, or CPU above about 70%), instances are added up to your maximum, and removed a few minutes after traffic drops. Calls from other services inside the VPC (
name.internal) reach the first instance. - Your app calls the database or cache over the private network. If they’re linked, the
DATABASE_URLvariable is set for you.
Your app should do these 4 things
- Listen on
0.0.0.0on the port from the$PORTvariable, not onlocalhost. - Answer the health check path with a status below 500 when it’s ready for work.
- Keep files users upload in Object Storage and data in a Database, because instances are added and removed as traffic changes.
- Write logs to stdout and stderr, and read them on the Logs tab.
Test your image on your own computer first with docker run -e PORT=8080 -p 8080:8080 image. If http://localhost:8080 opens, the deploy will most likely work too.