This project is designed to automate the react build, deployment, and serving of static websites like on the Vercel platform using Docker containers and BullMQ for task queuing.
- build-server: A server responsible for building React applications provided through GitHub URLs.
- api-server: Provides an API endpoint to add GitHub URLs to a Redis queue with BullMQ.
- s3-reverse-proxy: A reverse proxy server that serves static files from an S3 bucket to the end user.
- Node.js
- Docker
- Docker Compose
- Redis
- s3 Bucket
- Clone this repository.
- Navigate to the root directory of the project.
- Run
docker-compose up
to start all three tiers of the application. (or) you can manually route to each directory and runnpm start
- Access the API server via
http://localhost:4001
. - To add a GitHub URL to the build queue, send a POST request to
/build
with the following JSON payload:{ "subdomain": "example-subdomain", "gitUrl": "https://github.com/example/repo.git" }
- A new build job will be added to the queue, and the API server will respond with a message and the URL where the app will be served.
- The build server listens for new jobs on the
build-queue
and processes them. - It fetches the GitHub repository and initiates the build process.
- The S3 reverse proxy serves static files from an S3 bucket.
- Access static files via
http://subdomain.localhost:4003
.
Change the env variables in each of the following 3 - dir
- REDIS_SERVER_HOST: Hostname of the Redis server.
- REDIS_SERVER_PORT: Port of the Redis server.
- S3_BUCKET_ACCESS_KEY: Access key for the S3 bucket.
- S3_BUCKET_SECRET_KEY: Secret key for the S3 bucket.
- S3_BUCKET_REGION: Region of the S3 bucket.
- S3_ENDPOINT: Endpoint of the S3 bucket.
- PORT: Port for the API server and S3 reverse proxy.
- Fork the repository.
- Create your feature branch (
git checkout -b feature/fooBar
). - Commit your changes (
git commit -am 'Add some fooBar'
). - Push to the branch (
git push origin feature/fooBar
). - Create a new Pull Request.
This project is licensed under the MIT License.