Remove supervisord configuration and update README
This commit is contained in:
parent
578ec671c3
commit
dd38de25ee
33
README.md
33
README.md
@ -55,12 +55,12 @@ alembic upgrade head
|
||||
# Development mode
|
||||
uvicorn main:app --reload
|
||||
|
||||
# Production mode with Supervisor
|
||||
# Production mode
|
||||
cp .env.example .env # Create and customize your .env file
|
||||
supervisord -c supervisord.conf
|
||||
python -m uvicorn main:app --host 0.0.0.0 --port 8000
|
||||
```
|
||||
|
||||
The API will be available at http://localhost:8000 (development) or http://localhost:8001 (production with Supervisor).
|
||||
The API will be available at http://localhost:8000.
|
||||
|
||||
## API Documentation
|
||||
|
||||
@ -151,8 +151,7 @@ Once the application is running, you can access the API documentation at:
|
||||
│ ├── script.py.mako # Migration script template
|
||||
│ └── versions # Migration versions
|
||||
│ └── 001_initial_tables.py # Initial migration
|
||||
├── requirements.txt # Project dependencies
|
||||
└── supervisord.conf # Supervisor configuration
|
||||
└── requirements.txt # Project dependencies
|
||||
```
|
||||
|
||||
## Development
|
||||
@ -169,31 +168,25 @@ To apply migrations:
|
||||
alembic upgrade head
|
||||
```
|
||||
|
||||
### Using Supervisor
|
||||
### Running in Production
|
||||
|
||||
This application includes configuration for running with Supervisor, which provides process monitoring and automatic restarts. To view the status of the application when running with Supervisor:
|
||||
For production environments, you may want to use a process manager like systemd, PM2, or Docker to manage the application. Here's an example of running the application in the background using nohup:
|
||||
|
||||
```bash
|
||||
supervisorctl status
|
||||
```
|
||||
|
||||
To restart the application:
|
||||
|
||||
```bash
|
||||
supervisorctl restart app-8001
|
||||
nohup python -m uvicorn main:app --host 0.0.0.0 --port 8000 --log-level info > app.log 2>&1 &
|
||||
```
|
||||
|
||||
To view logs:
|
||||
|
||||
```bash
|
||||
tail -f /tmp/app-8001.log # Application logs (contains both stdout and stderr with redirect_stderr=true)
|
||||
tail -f app.log # Application logs
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you encounter issues with the application starting up:
|
||||
|
||||
1. Check the error logs: `tail -f /tmp/app-8001.log`
|
||||
1. Check the application logs where you redirected the output
|
||||
2. Verify the database path is correct and accessible
|
||||
3. Ensure all environment variables are properly set
|
||||
4. Check permissions for the storage directory
|
||||
@ -207,10 +200,10 @@ If you encounter issues with the application starting up:
|
||||
|
||||
If you encounter database access issues, you can set `USE_IN_MEMORY_DB=true` in your .env file to use an in-memory SQLite database instead of a file-based one. This can help isolate whether the issue is with file permissions or database configuration.
|
||||
|
||||
#### Supervisor Configuration
|
||||
#### Process Management
|
||||
|
||||
If Supervisor fails to start the application:
|
||||
- Make sure the paths in supervisord.conf are correct
|
||||
If you're using a process manager (like systemd, PM2, etc.) and encounter issues:
|
||||
- Make sure all paths are correctly configured
|
||||
- Check that the PYTHONPATH environment variable is set correctly
|
||||
- Verify that Supervisor has permission to run the application
|
||||
- Verify that the process manager has permission to run the application
|
||||
- Use `python -m uvicorn` instead of just `uvicorn` to ensure the Python module path is correct
|
@ -1,36 +0,0 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
logfile=/tmp/supervisord.log
|
||||
logfile_maxbytes=50MB
|
||||
logfile_backups=10
|
||||
loglevel=info
|
||||
pidfile=/tmp/supervisord.pid
|
||||
user=root
|
||||
|
||||
[program:app-8001]
|
||||
command=python -m uvicorn main:app --host 0.0.0.0 --port 8001 --log-level debug
|
||||
directory=/projects/bloggingapi-a05jzl
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=5
|
||||
numprocs=1
|
||||
startsecs=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/tmp/app-8001.log
|
||||
stdout_logfile_maxbytes=50MB
|
||||
stdout_logfile_backups=10
|
||||
environment=PORT=8001,PYTHONUNBUFFERED=1,PYTHONPATH=/projects/bloggingapi-a05jzl,USE_IN_MEMORY_DB=true
|
||||
|
||||
[program:app-8002]
|
||||
command=python -m uvicorn main:app --host 0.0.0.0 --port 8002 --log-level debug
|
||||
directory=/projects/bloggingapi-a05jzl
|
||||
autostart=true
|
||||
autorestart=true
|
||||
startretries=5
|
||||
numprocs=1
|
||||
startsecs=1
|
||||
redirect_stderr=true
|
||||
stdout_logfile=/tmp/app-8002.log
|
||||
stdout_logfile_maxbytes=50MB
|
||||
stdout_logfile_backups=10
|
||||
environment=PORT=8002,PYTHONUNBUFFERED=1,PYTHONPATH=/projects/bloggingapi-a05jzl,USE_IN_MEMORY_DB=true
|
Loading…
x
Reference in New Issue
Block a user