X-Stack

This project was created for EN814710 Cloud Applications and Networking.
One-Command Deployment. We provide a fast and easy deployment strategy.

Members

Member Student ID
Thanachai Kaewsaen 623040136-9
Jirawat Kurakhan 623040224-2
Warayut Poomiwatracanont 623040323-0
Sukon Sahunalu 623040495-1
Adison Wonglakhon 623040652-1

Software Architecture

Software Architecture

Setting up

Note that!: The OpenAI API is no longer free to use. Please consider using an alternative free API.

You need to go to https://platform.openai.com/ and get API secret key from there.
If you don't have one, please click at Create new secret key to get one.
API key might be in format like "sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

cd microservice-cloud-app
cp .env.example .env && vim .env

---Output---
// ...

OPENAI_API_KEY=sk-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  // ...

Run with Docker Compose

Verify that Docker Compose is installed correctly by checking the version (https://github.com/docker/compose/releases)

docker compose version

---Output---
Docker Compose version v2.23.3-desktop.2

Linux

docker compose up

Windows

docker-compose up

If your have any problem when docker build

docker compose up --build

Check your task or application

docker compose ps

Tear down your application

docker compose down

Usage

Front-End (NextJS)

http://localhost:3000

Username Password
admin 1234567890

Back-End (Pocketbase)

http://localhost:8090/\_/

Username Password
admin@xstack.com 1234567890

http://localhost:18083

Username Password
admin public

Run with Docker Swarm

Install Multipass on Linux

sudo snap install multipass

# Create a Ubuntu 22.04.1 LTS VM instances
multipass launch --name manager
multipass launch --name worker1
multipass launch --name worker2

Create a Swarm (Manager)

docker swarm init --advertise-addr <MANAGER IP Address>

Join to Swarm (Worker)

docker swarm join --token <TOKEN>

If you have problem when the worker nodes don't join to the swarm
docker swarm leave –-force

Check your Docker Swarm Cluster

docker node ls

Deploy and check your application

docker stack deploy -c docker-compose.yaml x-stack

Check your task or application

docker service ls

Tear down your application

docker stack rm x-stack