AI Powered SaaS: Stripe + Auth + Billing + Deploy · บทเรียน

การนำไปใช้งานบน VM คลาวด์

นำแอปพลิเคชันที่บรรจุใน Docker ไปใช้งานบนอินสแตนซ์เครื่องเสมือนของผู้ให้บริการคลาวด์ที่เลือก

บทเรียน 3 จาก 412 ขั้นตอน

การนำไปใช้งานบน VM คลาวด์ เป็นบทเรียน AI Powered SaaS: Stripe + Auth + Billing + Deploy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AI Powered SaaS: Stripe + Auth + Billing + Deploy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AI Powered SaaS: Stripe + Auth + Billing + Deploy มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Deploying to the Cloud

You've containerized your app with Docker. Now, it's time to put it online! This lesson covers deploying your Dockerized application to a cloud Virtual Machine (VM).

A VM acts like a remote computer where your app can run 24/7, accessible to users worldwide.

What's a Virtual Machine?

A Virtual Machine (VM) is a software-based computer that runs on a physical server in a cloud data center. It has its own CPU, memory, storage, and network interface, just like a physical machine.

  • Isolation: Each VM is isolated from others.
  • Flexibility: You choose the operating system (OS) and resources.
  • Persistence: Your app keeps running even if you disconnect.

Choosing Cloud Provider & OS

Major cloud providers offer VMs:

  • AWS EC2: Amazon Elastic Compute Cloud
  • GCP Compute Engine: Google Cloud Platform
  • Azure Virtual Machines: Microsoft Azure

For your Dockerized app, a Linux OS (like Ubuntu or CentOS) is typically the best and most cost-effective choice.

Launching Your Cloud VM

Launching a VM involves a few key steps:

  1. Instance Type: Select CPU/RAM based on app needs.
  2. Region: Choose a geographical location close to your users.
  3. Key Pair: Create a secure SSH key for access.
  4. Security Group/Firewall: Define network rules (e.g., allow SSH, HTTP/S).

These are configured through your cloud provider's console or API.

Connecting via SSH

Once your VM is launched, you'll connect to it using SSH (Secure Shell). This encrypted protocol allows you to execute commands remotely and securely.

You'll use the private key from your key pair to authenticate.

ssh -i /path/to/your-key.pem ubuntu@your-vm-ip

Installing Docker Engine

Your cloud VM starts fresh. The first step is to install Docker Engine, which allows your VM to run Docker containers.

For Ubuntu, you'd update packages, then install Docker. This makes your VM a Docker host!

sudo apt update
sudo apt install docker.io -y
sudo systemctl start docker
sudo systemctl enable docker

Pulling Your App's Image

With Docker installed, you need your application's Docker image on the VM. If you pushed your image to a registry like Docker Hub or a private cloud registry, you can simply pull it.

Replace your-username/your-app:latest with your actual image name.

docker pull your-username/your-app:latest

Launching Your Container

Now, run your container! The -p flag maps a port on your VM (e.g., 80) to a port inside your container (e.g., 3000, where your app listens).

The -d flag runs it in 'detached' mode, so it runs in the background.

docker run -d -p 80:3000 your-username/your-app:latest

Opening Ports (Firewall)

Even if your container is running, users can't reach it unless you open the necessary ports on your VM's firewall (often called 'security groups' in cloud providers).

You'll need to allow inbound traffic on port 80 (for HTTP) and potentially 443 (for HTTPS) from anywhere (0.0.0.0/0).

Checking Your Live App

After running your container and configuring the firewall, you can verify your deployment.

  • SSH: Use docker ps to see running containers.
  • Browser: Navigate to your VM's public IP address or domain name in a web browser.

If you see your app, congratulations!

docker ps

Deployment Check

You've deployed your Dockerized app to a cloud VM. What's the primary tool used to securely connect and manage your remote VM?

Recap: VM Deployment

In this lesson, you learned how to deploy your Dockerized application to a cloud Virtual Machine. We covered selecting a provider, launching an instance, connecting via SSH, installing Docker, pulling and running your image, and configuring network access.

This is a foundational step for making your SaaS application publicly available!

เริ่มต้นได้ฟรี

เรียนรู้ AI Powered SaaS: Stripe + Auth + Billing + Deploy ด้วย AI tutor — ฟรี

เขียนและเรียกใช้โค้ดจริงในเบราว์เซอร์ของคุณ รับความช่วยเหลือทันทีจาก AI tutor 24/7 และเรียนรู้ต่อจากที่คุณหยุดบนเว็บหรือในแอป

คอร์ส
12
บทเรียน
48

คำถามที่พบบ่อย

บทเรียน “การนำไปใช้งานบน VM คลาวด์” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การนำไปใช้งานบน VM คลาวด์” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AI Powered SaaS: Stripe + Auth + Billing + Deploy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AI Powered SaaS: Stripe + Auth + Billing + Deploy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การนำไปใช้งานบน VM คลาวด์”

นำแอปพลิเคชันที่บรรจุใน Docker ไปใช้งานบนอินสแตนซ์เครื่องเสมือนของผู้ให้บริการคลาวด์ที่เลือก คุณปฏิบัติ AI Powered SaaS: Stripe + Auth + Billing + Deploy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน AI Powered SaaS: Stripe + Auth + Billing + Deploy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน AI Powered SaaS: Stripe + Auth + Billing + Deploy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “การนำไปใช้งานบน VM คลาวด์” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน AI Powered SaaS: Stripe + Auth + Billing + Deploy นี้ได้ไหม

ได้ บทเรียน AI Powered SaaS: Stripe + Auth + Billing + Deploy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. การทำแอปพลิเคชันให้เป็นคอนเทนเนอร์ด้วย Docker
  2. บทนำสู่ผู้ให้บริการคลาวด์
  3. การนำไปใช้งานบน VM คลาวด์
  4. แอปหลายคอนเทนเนอร์ด้วย Docker Compose
← กลับไปที่ AI Powered SaaS: Stripe + Auth + Billing + Deploy