This repository contains the Poverty Mapping web application for Cambodia, built with Django and utilizing Google Earth Engine, designed to be deployed on an Ubuntu server using Docker.
- Ubuntu server
- Docker and Docker Compose installed
- Google Service Account (obtainable from developers)
-
Install Docker:
sudo apt-get update sudo apt-get install docker.io sudo apt-get install docker-compose-v2 sudo systemctl start docker sudo systemctl enable docker
-
Clone the Project Repository:
git clone https://github.com/sig-gis/cambodia-poverty-mapping.git cambodia-poverty-mapping
-
Obtain Google Service Account Credentials:
- Request Credentials: Contact the developers at [email protected] to obtain the Google Service Account credential file.
- Add Credentials: Place the credential file in the project's root directory.
- Build and Run the Application with Docker:
- Build the Docker Image:
sudo docker compose build
- Run the Container:
sudo docker compose up -d
- Check the Status: Verify that the container is running correctly:
sudo docker compose ps
- Configure Nginx as a Reverse Proxy:
- Install Nginx:
sudo apt install nginx
- Create Nginx Configuration: Use nano to create the Nginx configuration file:
sudo nano /etc/nginx/sites-available/povertymappingapp.com
- Paste the Configuration: Replace <ip_or_domain_name> with your actual values:
server {
listen 80;
server_name <ip_or_domain_name>;
location / {
proxy_pass http://127.0.0.1:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
- Enable Configuration: Create a symbolic link to enable the configuration:
sudo ln -s /etc/nginx/sites-available/povertymappingapp.com /etc/nginx/sites-enabled/
- Remove Default Configuration:
sudo rm /etc/nginx/sites-enabled/default
- Test and Restart Nginx:
sudo nginx -t
sudo systemctl restart nginx
You can now access the tool using your server's IP or domain name.