Deadtrees.earth
An open database for accessing, contributing, analyzing, and visualizing remote sensing-based tree mortality data.
https://github.com/deadwood-ai/deadtrees
Category: Biosphere
Sub Category: Forest Remote Sensing
Last synced: about 18 hours ago
JSON representation
Repository metadata
Main FastAPI application for the deadwood backend
- Host: GitHub
- URL: https://github.com/deadwood-ai/deadtrees
- Owner: Deadwood-ai
- License: gpl-3.0
- Created: 2024-06-26T13:58:07.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-12-13T11:55:16.000Z (28 days ago)
- Last Synced: 2025-12-25T14:58:26.895Z (16 days ago)
- Language: Python
- Size: 1.45 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 52
- Releases: 36
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Deadwood API
Main FastAPI application for the deadwood backend. This repository contains both the API and processor components for processing geospatial data and performing deadwood segmentation.
Prerequisites
- Docker and Docker Compose
- NVIDIA GPU with CUDA support (for deadwood segmentation)
Setup
Clone the repository with submodules:
# Clone the repository
git clone https://github.com/deadtrees/deadwood-api.git
cd deadwood-api
# Initialize and update submodules
git submodule update --init --recursive
Create a .env file with required environment variables:
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
PROCESSOR_PASSWORD=your_processor_password
STORAGE_SERVER_USERNAME=your_username
SSH_PRIVATE_KEY_PATH=/path/to/your/ssh/key
STORAGE_SERVER_DATA_PATH=/apps/storage-server/production
DEV_MODE=true
LOGFIRE_TOKEN=your_logfire_token
Download required assets:
# Create assets directory and download test data, models, and GADM data
make
Use the CLI tool to manage the development environment (CLI-first):
# Start the development environment
deadtrees dev start
# Stop the development environment
deadtrees dev stop
# Rebuild the development environment
deadtrees dev start --force-rebuild
# Run development environment with continuous processor queue checking
deadtrees dev run-dev
# Run API tests
deadtrees dev test api
# Debug API tests
deadtrees dev debug api --test-path=api/tests/routers/test_download.py
# Run processor tests
deadtrees dev test processor
# Debug processor tests
deadtrees dev debug processor --test-path=processor/tests/test_processor.py
Accessing services (Test Stack)
the nginx acts as a reverse proxy for the API and processor services.
# nginx
http://localhost:8080/cogs/v1/
http://localhost:8080/thumbnails/v1/
http://localhost:8080/downloads/v1/
# API Endpoints
http://localhost:8080/api/v1/
# API docs
http://localhost:8080/api/v1/docs
# Upload Chunks
http://localhost:8080/api/v1/datasets/chunk
# Download Endpoint
http://localhost:8080/api/v1/download/docs
http://localhost:8080/api/v1/download/datasets/1/dataset.zip
# Supabase
# Pooler/API: http://host.docker.internal:54321
# Studio: http://127.0.0.1:54323
Notes on Tests
- Prefer the
deadtreesCLI for running tests and debugging. Avoid callingpytestdirectly in containers.
Local supabase setup and development
## install supabase cli
brew install supabase
# Start Supabase
supabase login
# Initialize project
supabase init
# Link to project
supabase link --project-ref <project-ref>
# Start Supabase
supabase start
# Create initial migration file
# supabase db diff --use-migra initial_schema -f initial_schema --linked
supabase db pull
# Apply the migration
supabase migration up
# to reset the database
supabase db reset
# set new env varialbes based on the output of supabase start
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
Project structure
/assets - Downloaded data and models
/gadm - GADM geographic data
/models - ML models for deadwood segmentation
/test_data - Test GeoTIFF files
/api - FastAPI application
/src - Source code
/tests - API tests
/processor - Data processing service
/src - Source code
/tests - Processor tests
/shared - Shared code between API and processor
API - Deployment
Additional requirements
So far I found the following packages missing on the Hetzner ubuntu image:
apt install -y make unzip
Setup user
create a user for everyone to log in (using root)
useradd dendro
usermod -aG docker dendro
Init git and download repo
Next upload SSH keys for developers to home/dendro/.ssh/authorized_keys
Add Env variables to the key, to set the git user for each developer
command="export $GIT_AUTHOR_NAME='yourname' && export $GIT_AUTHOR_EMAIL='your-email';exec $SHELL -l" key
Next change the /home/dendro/.bashrc to configure git, add to the end:
if [[ -n "$GIT_AUTHOR_NAME" && -n "$GIT_AUTHOR_EMAIL" ]]; then
git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"
fi
Now, you can download the repo, including the private repo.
# Clone the repository
git clone git@github.com:deadtrees/deadwood-api.git
cd deadwood-api
# Initialize and update submodules
git submodule update --init --recursive
Create a .env file with required environment variables:
On the Storage server, only the necessary env is set
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
LOGFIRE_TOKEN=your_logfire_token
Download required assets:
# Create assets directory and download test data, models, and GADM data
make
Build the repo
Optionally, you can alias the call of the correct docker compose file. Add to .bashrc
alias serv='docker compose -f docker-compose.api.yaml'
Certificate issueing & renewal
The certbot service can be used to issue a certificate. For that, the ACME challange
has to be served by a temporary nginx:
server {
listen 80;
listen [::]:80;
server_name default_server;
server_tokens off;
# add ACME challange for certbot
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
Then run the certbot service with all the mounts as configured in the docker-compose.api.yaml:
serv certbot certonly
Once successfull, you can start a cronjob to renew the certificate:
crontab -e
And add the following cronjob to run every Sunday night at 1:30. Currently we are not notified if this
fails and thus needs to be monitored for now:
30 1 * * 0 docker compose -f /apps/deadtrees/docker-compose.api.yaml run --rm certbot renew
Owner metadata
- Name: Deadwood-ai
- Login: Deadwood-ai
- Email:
- Kind: organization
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/158443411?v=4
- Repositories: 1
- Last ynced at: 2024-02-12T08:58:40.132Z
- Profile URL: https://github.com/Deadwood-ai
GitHub Events
Total
- Issues event: 151
- Watch event: 1
- Delete event: 16
- Issue comment event: 110
- Member event: 2
- Push event: 194
- Pull request event: 23
- Create event: 12
Last Year
- Issues event: 151
- Watch event: 1
- Delete event: 16
- Issue comment event: 110
- Member event: 2
- Push event: 194
- Pull request event: 23
- Create event: 12
Committers metadata
Last synced: 2 days ago
Total Commits: 776
Total Committers: 5
Avg Commits per committer: 155.2
Development Distribution Score (DDS): 0.235
Commits in past year: 398
Committers in past year: 3
Avg Commits per committer in past year: 132.667
Development Distribution Score (DDS) in past year: 0.068
| Name | Commits | |
|---|---|---|
| jesjehle | j****e@g****m | 594 |
| Mirko Mälicke | m****o@h****e | 161 |
| lucfr | l****s@h****e | 9 |
| JesJehle | j****e@g****e | 9 |
| Clemens Mosig | c****g@u****e | 3 |
Committer domains:
Issue and Pull Request metadata
Last synced: 27 days ago
Total issues: 89
Total pull requests: 13
Average time to close issues: about 1 month
Average time to close pull requests: 3 days
Total issue authors: 5
Total pull request authors: 2
Average comments per issue: 0.96
Average comments per pull request: 1.23
Merged pull request: 12
Bot issues: 0
Bot pull requests: 0
Past year issues: 85
Past year pull requests: 13
Past year average time to close issues: 26 days
Past year average time to close pull requests: 3 days
Past year issue authors: 5
Past year pull request authors: 2
Past year average comments per issue: 0.89
Past year average comments per pull request: 1.23
Past year merged pull request: 12
Past year bot issues: 0
Past year bot pull requests: 0
Top Issue Authors
- JesJehle (76)
- cmosig (9)
- tejakattenborn (2)
- mafla (1)
- Tristl (1)
Top Pull Request Authors
- JesJehle (12)
- mmaelicke (1)
Top Issue Labels
- bug (14)
- draft (6)
- question (3)
- Bug (1)
- enhancement (1)
- help wanted (1)
- Feature (1)
Top Pull Request Labels
Dependencies
- fastapi *
- prometheus-client *
- pydantic-settings *
- python-dotenv *
- python-multipart *
- supabase *
- uvicorn *
- actions/checkout v3 composite
- docker/build-push-action v3 composite
- docker/login-action v2 composite
- docker/metadata-action v4 composite
- docker/setup-buildx-action v2 composite
- docker/setup-qemu-action v2 composite
- softprops/action-gh-release v1 composite
- python 3.12.1 build
Score: 5.598421958998375