Appearance
fAIr Docker Installation Guide
This guide will help you set up the fAIr project for local development using Docker Compose.
Note: This setup is for development only. For production, use a more secure and robust deployment.
Prerequisites
- Docker & Docker Compose
- Git
- (Recommended) An NVIDIA GPU with drivers and NVIDIA Container Toolkit
- (Optional) Python 3.9+ and pip
1. Clone the Repository
sh
git clone https://github.com/hotosm/fAIr.git
cd fAIr2. Verify Docker Installation
sh
docker compose version3. Check GPU Availability (Optional, but recommended)
fAIr works best with an NVIDIA GPU.
Check your GPU and drivers:
sh
nvidia-smiIf using Docker with GPU, ensure NVIDIA Container Toolkit is installed.
4. Prepare Model Data and RAMP_HOME
Create a folder for RAMP data (outside the fAIr repo):
shmkdir ~/rampDownload the base model checkpoint:
Download from Google Drive
Or use the Model Ramp Baselineshpip install gdown gdown --fuzzy https://drive.google.com/file/d/1YQsY61S_rGfJ_f6kLQq4ouYE2l3iRe1k/viewClone Ramp code:
shgit clone https://github.com/kshitijrajsharma/ramp-code-fAIr.git ramp-codeUnzip the base model and move it into
ramp-code/ramp:shunzip checkpoint.tf.zip -d ramp-code/rampSet environment variables:
shexport RAMP_HOME=/path/to/your/ramp export TRAINING_WORKSPACE=/path/to/your/fAIr/trainings
5. Register Your Local Setup with OSM
- Go to OpenStreetMap, log in or create an account.
- Go to My Settings → Oauth2 Applications → Register a new application.
- Set permissions for "Read user preferences" and set Redirect URI to
http://127.0.0.1:3000/authenticate/. - Copy your
OSM_CLIENT_IDandOSM_CLIENT_SECRET.
6. Configure Environment Variables
Backend:
sh
cd backend
cp docker_sample_env .env- Fill in
OSM_CLIENT_ID,OSM_CLIENT_SECRET, and a randomOSM_SECRET_KEYin.env.
Frontend:
sh
cd ../frontend
cp .env_sample .env- You can leave the frontend
.envas is for development.
7. Build & Run Containers
sh
docker compose build
docker compose up8. Run Database Migrations
You can use the provided script:
sh
bash run_migrations.shOr run manually inside the API container:
sh
docker exec -it api bash
python manage.py makemigrations
python manage.py makemigrations login
python manage.py makemigrations core
python manage.py migrate9. Access the Services
- Frontend: http://127.0.0.1:3000
(Use127.0.0.1instead oflocalhostfor login to work) - Backend API: http://127.0.0.1:8000
- Flower (Task Queue Monitor): http://127.0.0.1:5500
10. (Optional) Use Local Tiles
If you want to serve your own map tiles, use titiler, gdal2tiles, or nginx.
To allow Docker containers to access your local TMS server, add:
yaml
network_mode: "host"to the relevant services in your docker-compose file, and update .env accordingly.
Troubleshooting
- Docker not running? Start Docker Desktop.
- Port conflicts? Change ports in
docker-compose.prod.yml. - Database/Redis issues?sh
docker compose logs postgres docker compose logs redis
For more help, open an issue on GitHub or join our community Slack.
Happy mapping!