This guide covers how to set up and run the AtlasEye satellite change detection system using Docker and Docker Compose.
- Docker (version 20.10.0+)
- Docker Compose (version 2.0.0+)
- Git
- At least 8GB RAM
- 20GB+ free disk space
- NVIDIA GPU (optional, but recommended for faster training)
- NVIDIA Container Toolkit (if using GPU)
git clone https://github.com/yourusername/atlaseye.git
cd atlaseyemkdir -p data/models data/images data/training/before data/training/after data/training/mask data/test_dataCreate a .env file in the root directory:
# Backend settings
POSTGRES_SERVER=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=satellite_change
MODEL_PATH=/app/data/models/unet_model.pth
LOCAL_STORAGE_PATH=/app/data/images
# Frontend settings
NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token_hereNote: Obtain a Mapbox token from mapbox.com if you want to use the interactive map features.
docker-compose buildThis command builds all the services defined in the docker-compose.yml file.
docker-compose up -ddocker-compose psYou should see all services (postgres, redis, backend, celery_worker, frontend) in the "Up" state.
docker-compose run --rm backend python -m app.db.test_connectionIf successful, you'll see PostgreSQL and PostGIS version information.
If you have training data prepared in the respective directories, you can train the model:
docker-compose run --rm backend python -m app.ml.training.train \
--data_dir=/app/data/training \
--checkpoint_dir=/app/data/models \
--batch_size=8 \
--num_epochs=50 \
--learning_rate=0.001 \
--image_size=256 \
--device=cpu # Use 'cuda' for GPU accelerationFor GPU acceleration:
- Uncomment the GPU section in
docker-compose.yml:deploy: resources: reservations: devices: - driver: nvidia count: 1 capabilities: [gpu]
- Use
--device=cudain the training command
Test the trained model with sample images:
docker-compose run --rm backend python -m app.ml.inferencer.test_predictor \
--model_path=/app/data/models/final_model.pth \
--before=/app/data/test_data/before.tif \
--after=/app/data/test_data/after.tif \
--output_dir=/app/data/test_results- Frontend UI: http://localhost:3000
- Backend API docs: http://localhost:8000/docs
Using the web UI:
- Go to http://localhost:3000/upload
- Upload before and after satellite images
- Submit the form
Or using curl:
curl -X POST http://localhost:8000/api/v1/detection/upload-images/ \
-F "before_image=@/path/to/before.tif" \
-F "after_image=@/path/to/after.tif"Note the job_id from the response.
Using the API:
curl -X POST http://localhost:8000/api/v1/detection/process/{job_id}Replace {job_id} with the actual ID received from the upload step.
In the web UI, navigate to: http://localhost:3000/results/{job_id}
Or via API:
curl http://localhost:8000/api/v1/detection/results/{job_id}Run all backend tests:
docker-compose run --rm backend python -m unittest discover testsRun specific test modules:
# ML module tests
docker-compose run --rm backend python -m unittest tests.test_ml
# API tests
docker-compose run --rm backend python -m unittest tests.test_apidocker-compose run --rm frontend npm run lintView all logs:
docker-compose logsView specific service logs:
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f postgresdocker-compose psdocker-compose restart backend
docker-compose restart frontendStop all services but preserve volumes and containers:
docker-compose stopStop and remove containers (preserves volumes):
docker-compose downComplete cleanup (removes volumes too, WILL DELETE DATABASE DATA):
docker-compose down -vdocker-compose up -d --scale celery_worker=3Edit docker-compose.yml to add resource constraints:
services:
backend:
deploy:
resources:
limits:
cpus: '2'
memory: 2GFor complex deployments, you can create custom networks:
networks:
frontend_network:
backend_network:
services:
frontend:
networks:
- frontend_network
backend:
networks:
- frontend_network
- backend_networkFor production, consider adding a reverse proxy like Nginx:
services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./ssl:/etc/nginx/ssl
depends_on:
- backend
- frontend