update
Browse files- Dockerfile +2 -2
- README.md +12 -8
- docker-compose.yml +6 -2
- prestart.sh +1 -1
- start.sh +1 -1
Dockerfile
CHANGED
|
@@ -52,5 +52,5 @@ USER appuser
|
|
| 52 |
# Expose the port
|
| 53 |
EXPOSE 5000
|
| 54 |
|
| 55 |
-
# Run the
|
| 56 |
-
CMD ["/
|
|
|
|
| 52 |
# Expose the port
|
| 53 |
EXPOSE 5000
|
| 54 |
|
| 55 |
+
# Run the application directly with gunicorn
|
| 56 |
+
CMD ["gunicorn", "--config=./gunicorn.conf.py", "--workers=2", "app:create_app"]
|
README.md
CHANGED
|
@@ -128,23 +128,27 @@ pip install torch==2.0.1
|
|
| 128 |
#### Docker Startup Issues
|
| 129 |
If you encounter issues with Docker startup:
|
| 130 |
|
| 131 |
-
1. Check
|
| 132 |
-
```bash
|
| 133 |
-
chmod +x prestart.sh start.sh healthcheck.sh
|
| 134 |
-
```
|
| 135 |
-
|
| 136 |
-
2. Verify the Docker logs:
|
| 137 |
```bash
|
| 138 |
docker-compose logs web
|
| 139 |
```
|
| 140 |
|
| 141 |
-
|
| 142 |
```bash
|
| 143 |
docker-compose build --no-cache web
|
| 144 |
docker-compose up -d
|
| 145 |
```
|
| 146 |
|
| 147 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 148 |
|
| 149 |
## Testing
|
| 150 |
Run the test suite:
|
|
|
|
| 128 |
#### Docker Startup Issues
|
| 129 |
If you encounter issues with Docker startup:
|
| 130 |
|
| 131 |
+
1. Check Docker logs for detailed error messages:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
```bash
|
| 133 |
docker-compose logs web
|
| 134 |
```
|
| 135 |
|
| 136 |
+
2. Try rebuilding the Docker image:
|
| 137 |
```bash
|
| 138 |
docker-compose build --no-cache web
|
| 139 |
docker-compose up -d
|
| 140 |
```
|
| 141 |
|
| 142 |
+
3. If you see syntax errors with parentheses in the command, the issue has been fixed in the latest version by removing the parentheses from the gunicorn command.
|
| 143 |
+
|
| 144 |
+
4. Ensure all required packages are in requirements.txt:
|
| 145 |
+
```bash
|
| 146 |
+
# Check if ratelimit is in requirements.txt
|
| 147 |
+
grep ratelimit requirements.txt
|
| 148 |
+
|
| 149 |
+
# If not, add it
|
| 150 |
+
echo "ratelimit==2.2.1" >> requirements.txt
|
| 151 |
+
```
|
| 152 |
|
| 153 |
## Testing
|
| 154 |
Run the test suite:
|
docker-compose.yml
CHANGED
|
@@ -2,7 +2,9 @@ version: '3.8'
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
web:
|
| 5 |
-
build:
|
|
|
|
|
|
|
| 6 |
ports:
|
| 7 |
- "5000:5000"
|
| 8 |
environment:
|
|
@@ -29,7 +31,9 @@ services:
|
|
| 29 |
start_period: 40s
|
| 30 |
|
| 31 |
celery_worker:
|
| 32 |
-
build:
|
|
|
|
|
|
|
| 33 |
command: celery -A celery_worker.celery worker --loglevel=info
|
| 34 |
environment:
|
| 35 |
- FLASK_ENV=production
|
|
|
|
| 2 |
|
| 3 |
services:
|
| 4 |
web:
|
| 5 |
+
build:
|
| 6 |
+
context: .
|
| 7 |
+
dockerfile: Dockerfile
|
| 8 |
ports:
|
| 9 |
- "5000:5000"
|
| 10 |
environment:
|
|
|
|
| 31 |
start_period: 40s
|
| 32 |
|
| 33 |
celery_worker:
|
| 34 |
+
build:
|
| 35 |
+
context: .
|
| 36 |
+
dockerfile: Dockerfile
|
| 37 |
command: celery -A celery_worker.celery worker --loglevel=info
|
| 38 |
environment:
|
| 39 |
- FLASK_ENV=production
|
prestart.sh
CHANGED
|
@@ -41,4 +41,4 @@ if ! pip show torch &> /dev/null && ! pip show tensorflow &> /dev/null; then
|
|
| 41 |
fi
|
| 42 |
|
| 43 |
echo "All dependencies checked. Starting application..."
|
| 44 |
-
exit 0
|
|
|
|
| 41 |
fi
|
| 42 |
|
| 43 |
echo "All dependencies checked. Starting application..."
|
| 44 |
+
exit 0
|
start.sh
CHANGED
|
@@ -33,4 +33,4 @@ fi
|
|
| 33 |
|
| 34 |
# Start gunicorn
|
| 35 |
echo "Starting gunicorn..."
|
| 36 |
-
exec gunicorn $GUNICORN_OPTS
|
|
|
|
| 33 |
|
| 34 |
# Start gunicorn
|
| 35 |
echo "Starting gunicorn..."
|
| 36 |
+
exec gunicorn $GUNICORN_OPTS app:create_app
|