Hoster is a hosting platform which can be used to deploy your project from github using a hostname, utilizing AWS services, Express, Socket.io, Redis, and Node.js for the backend, with a Next.js frontend.
Hoster is designed with the following architecture:
Frontend
: Built with Next.js and uses axios for fetching data from API server.API Server
: HTTP API Server for REST API's.Build Server
: Creates Docker containers, clones client GitHub repositories, builds projects, and pushes build artifacts in AWS S3.Reverse Proxy
: Routes client requests to the correct build artifacts in AWS S3 using a custom reverse proxy.Redis
: Used for log storage and retrieval, providing real-time log access through Socket.io.Socket.io
: Facilitates real-time communication for log access and updates.AWS Services
: Utilizes AWS SDK for JavaScript, AWS ECR, and AWS ECS for container orchestration and deployment and S3 for storing build codes.
- Next.js: Framework for the frontend, enabling server-side rendering and static site generation.
- Node.js: JavaScript runtime for building the backend server.
- Express: Web application framework for Node.js, handling API routes and server logic.
- Docker: Containerization technology used to build and deploy applications in isolated environments.
- AWS S3: Object storage service used to store build artifacts.
- AWS ECR: Docker container registry for storing Docker images.
- AWS ECS: Service for running Docker containers at scale.
- Redis: In-memory data structure store used for logging and real-time data processing.
- Socket.io: Library for real-time, bidirectional event-based communication.
- Reverse Proxy: Custom proxy server that maps client requests to the appropriate build artifacts.
Before setting up Hoster, ensure you have the following prerequisites:
- Node.js and npm (or Yarn) installed on your local machine.
- Docker installed for containerization.
- An AWS account with S3, ECR, and ECS services configured.
- Redis server or service available for logging.
- Git for version control and repository management.
This Project contains following services and folders:
api-server
: HTTP API Server for REST API'sbuild-server
: Docker Image code which clones, builds and pushes the build to S3s3-reverse-proxy
: Reverse Proxy the subdomains and domains to s3 bucket static assets
To set up Hoster, follow these steps:
- Clone the Repository:
git clone https://github.com/yashsharma127/Hoster.git cd hoster
- Run
npm install
in all the 3 services i.e.api-server
,build-server
andreverse-proxy
- Rename
.env.example
to.env
in all the 3 services and add the required values to them. - Docker build the
build-server
and push the image to AWS ECR. - Setup the
api-server
by providing all the required config such as TASK ARN and CLUSTER arn. - Run
node index.js
inapi-server
andreverse-proxy
At this point following services would be up and running:
S.No | Service | PORT |
---|---|---|
1 | api-server |
:9000 |
2 | socket.io-server |
:9002 |
3 | reverse-proxy |
:8000 |
Remember to replace the values in .env files with your own values, and other variables with the actual values relevant to your setup.