Skip to content

Commit

Permalink
docs: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
589hero committed Dec 20, 2024
1 parent a436ca7 commit eaee157
Showing 1 changed file with 48 additions and 16 deletions.
64 changes: 48 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,54 @@

Serving Super Resolution Model Using FastAPI and Celery.

## For Developers

1. install dev package.
## How to start
### Using docker-compose(recommended)
1. Create RabbitMQ and FastAPI container(refer to [SR-FastAPI](https://github.com/ainize-team/SR-FastAPI))

2. Clone repository
```shell
pip install -r requirements.txt
pip install -r requirements-dev.txt
git clone https://github.com/ainize-team/SR-Worker
cd SR-Worker
```

2. install pre-commit.
3. Edit [docker-compose.yml](./docker-compose.yml) and [.env file](./.env.sample) for your project.
- Vhost for each worker is in [docker-compose.yml](./docker-compose.yml) and common RabbitMQ config is in [.env file](./.env.sample).

4. Run worker container
```shell
pre-commit install
docker-compose up -d

# If you want to run a specific worker container, write service name.
docker-compose up -d <service name>
```

## Installation
1. Run RabbitMQ image as a broker
### Using docker
1. Run RabbitMQ comtainer as a broker
```shell
docker run -d --name sr-rabbitmq -p 5672:5672 -p 8080:15672 --restart=unless-stopped rabbitmq:3.9.21-management
docker run -d --name sr-rabbitmq -p 5672:5672 -p 15672:15672 --restart=unless-stopped rabbitmq:3.11.2-management
```

2. Build docker image
2. Clone repository
```shell
git clone https://github.com/ainize-team/SR-Worker.git
git clone https://github.com/ainize-team/SR-Worker
cd SR-Worker
```

3. Build docker image
```shell
docker build -t sr-worker .
```

3. Run docker image
4. Run docker container
```shell
docker run -d --name <worker_container_name> \
--gpus='"device=0"' -e BROKER_URI=<broker_uri> \
-e DATABASE_URL=<firebase_realtime_database_url> \
-e STORAGE_BUCKET=<firebase_storage_url> \
-e FIREBASE_DATABASE_URL=<firebase_realtime_database_url> \
-e FIREBASE_STORAGE_BUCKET=<firebase_storage_url> \
-v <firebase_credential_path>:/app/key -v <model_local_path>:/app/model \
sr-worker
```
Or, you can use the env file to run as follows.
Or, you can use the [.env file](./.env.sample) to run as follows.
```shell
docker run -d --name <worker_container_name> \
--gpus='"device=0"' \
Expand All @@ -48,5 +58,27 @@ docker run -d --name <worker_container_name> \
sr-worker
```








## For Developers

1. install dev package.

```shell
pip install -r requirements.txt
pip install -r requirements-dev.txt
```

2. install pre-commit.

```shell
pre-commit install
```

## Test with FastAPI
- Check our [SR-FastAPI](https://github.com/ainize-team/SR-FastAPI) Repo.

0 comments on commit eaee157

Please sign in to comment.