- Added package.json for project dependencies and scripts. - Created redis.ts for Redis connection configuration. - Set up tsconfig.json for TypeScript compilation settings. - Implemented worker.ts to handle GitHub repository deployments using BullMQ and Octokit.
70 lines
1.5 KiB
Markdown
70 lines
1.5 KiB
Markdown
# Worker Setup for Website Generator
|
|
|
|
|
|
## Docker Installation
|
|
|
|
This project requires Docker to be installed on your system.
|
|
1. **Install Docker**: Follow the official installation guide for your operating system:
|
|
* [Install Docker Engine](https://docs.docker.com/engine/install/)
|
|
|
|
2. **Post-installation steps for Linux**: If you are on Linux, follow the post-installation steps to manage Docker as a non-root user.
|
|
* [Linux post-installation steps](https://docs.docker.com/engine/install/linux-postinstall/)
|
|
|
|
3. **Verify Installation**: Run the following command to verify that Docker is installed correctly.
|
|
```bash
|
|
docker run hello-world
|
|
```
|
|
|
|
# Deployment -
|
|
|
|
## Setup environment variables
|
|
|
|
```bash
|
|
mv .env.example .env
|
|
```
|
|
|
|
|
|
```txt
|
|
# ------------------------------
|
|
# Redis Configuration
|
|
# ------------------------------
|
|
REDIS_URL=redis://username:your_password@HOST:PORT
|
|
|
|
# ------------------------------
|
|
# GitHub Configuration
|
|
# ------------------------------
|
|
# Scopes required: 'repo' (to create repos and push code)
|
|
GITHUB_TOKEN=ghp_xxxxxx
|
|
|
|
# The GitHub username associated with the token above
|
|
GITHUB_USERNAME=github_username
|
|
```
|
|
|
|
# Build and run
|
|
```bash
|
|
docker compose up --build -d
|
|
```
|
|
or
|
|
```bash
|
|
docker-compose up --build -d
|
|
```
|
|
|
|
# View logs
|
|
```bash
|
|
docker-compose logs -f worker
|
|
```
|
|
# Restart worker
|
|
|
|
```bash
|
|
docker-compose restart worker
|
|
```
|
|
# Stop worker
|
|
|
|
```bash
|
|
docker-compose down
|
|
```
|
|
|
|
# Rebuild after code changes
|
|
```bash
|
|
docker-compose up --build -d
|
|
``` |