-
Notifications
You must be signed in to change notification settings - Fork 1
Fix Docker build and runtime issues for cross-platform support #243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4298880
Fix Docker build and runtime issues for cross-platform support
aashish24 3da8e86
Address PR review feedback
aashish24 3de3de5
Address additional PR review feedback
aashish24 56e8063
docs: add Windows-specific troubleshooting for Docker commands
aashish24 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,184 @@ | ||
| ### Initial Setup | ||
| # Setup Guide | ||
|
|
||
| 1. Prepare the web client with the following steps: | ||
| This guide walks you through setting up GeoInsight for local development using Docker Compose. | ||
|
|
||
| 1. Run `cp web/.env.example web/.env`. | ||
| 2. Install client dependencies by running `cd web && npm i`. | ||
| ## Prerequisites | ||
|
|
||
| 2. Run the docker containers with `docker compose up`. Be sure to check that all containers were able to start and stay running successfully before continuing. | ||
| 3. While the containers are up, run the following commands in a separate terminal to prepare the database: | ||
| - [Docker](https://docs.docker.com/get-docker/) (v20.10+) | ||
| - [Docker Compose](https://docs.docker.com/compose/install/) (v2.0+) | ||
| - [Node.js](https://nodejs.org/) (v22+ recommended) | ||
| - [npm](https://www.npmjs.com/) | ||
|
|
||
| a. Run `docker compose run --rm django ./manage.py migrate`. | ||
| --- | ||
|
|
||
| b. Run `docker compose run --rm django ./manage.py createsuperuser` | ||
| and follow the prompts to create your own user. | ||
| ## Initial Setup | ||
|
|
||
| c. Run `docker compose run --rm django ./manage.py makeclient` to create a client Application object for authentication. | ||
| ### 1. Prepare the Web Client | ||
|
|
||
| d. Run `docker compose run --rm django ./manage.py ingest {JSON file}` to use sample data. | ||
| ```bash | ||
| # Copy environment configuration | ||
| cp web/.env.example web/.env | ||
| ``` | ||
|
|
||
| - The JSON file can either be `multiframe_test.json`, `boston_floods.json`, `la_wildfires.json` or `./new_york_energy/data.json` | ||
| ### 2. Build and Start Docker Containers | ||
|
|
||
| ### Run Application | ||
| ```bash | ||
| docker compose build | ||
| docker compose up | ||
aashish24 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| 1. Run `docker compose up`. | ||
| 2. You can access the admin page at port 8000: http://localhost:8000/admin/ | ||
| 3. The user interface is on port **8080**: http://localhost:8080/ | ||
| 4. When finished, use `Ctrl+C` to stop the docker compose command. | ||
| > **Note:** Ensure all containers start and stay running before continuing. Check the logs for any errors. | ||
|
|
||
| ### Application Maintenance | ||
| ### 3. Initialize the Database | ||
|
|
||
| Occasionally, new package dependencies or schema changes will necessitate | ||
| maintenance. To non-destructively update your development stack at any time: | ||
| While the containers are running, open a **separate terminal** and run: | ||
|
|
||
| 1. Run `docker compose pull` | ||
| 2. Run `docker compose build --pull --no-cache` | ||
| 3. Run `docker compose run --rm django ./manage.py migrate` | ||
| ```bash | ||
| # Apply database migrations | ||
| docker compose run --rm django python manage.py migrate | ||
|
|
||
| # Create an admin user (you will be prompted for email and password) | ||
| docker compose run --rm -it django python manage.py createsuperuser | ||
|
|
||
| # Create OAuth client for authentication | ||
| docker compose run --rm django python manage.py makeclient | ||
| ``` | ||
|
|
||
| > **Note:** The `createsuperuser` command prompts you to create login credentials (email and password). Use these credentials to sign into both the Admin Panel and User Interface. If you forget your password, run `createsuperuser` again to create a new admin account. | ||
|
|
||
| > **Windows Users:** If the `createsuperuser` command hangs or doesn't show prompts, prefix the command with `winpty`: | ||
| > ```bash | ||
| > winpty docker compose run --rm -it django python manage.py createsuperuser | ||
| > ``` | ||
|
|
||
| ### 4. Load Sample Data (Optional) | ||
|
|
||
| The ingest command loads datasets, charts, and project configuration from an ingestion file: | ||
|
|
||
| ```bash | ||
| docker compose run --rm django python manage.py ingest {JSON_FILE} | ||
| ``` | ||
|
|
||
| Available ingest options (paths relative to `sample_data/`): | ||
| - `multiframe_test.json` | ||
| - `boston_floods.json` | ||
| - `la_wildfires.json` | ||
| - `new_york_energy/data.json` | ||
|
|
||
| --- | ||
|
|
||
| ## Running the Application | ||
|
|
||
| ### Start the Services | ||
|
|
||
| **Default (CPU-only):** | ||
| ```bash | ||
| docker compose up | ||
| ``` | ||
|
|
||
| **With GPU acceleration (NVIDIA systems only):** | ||
| ```bash | ||
| docker compose --profile gpu up --scale celery=0 | ||
| ``` | ||
|
|
||
| > **Note:** GPU mode requires NVIDIA drivers and [nvidia-docker](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html) runtime. | ||
|
|
||
| ### Access Points | ||
|
|
||
| | Service | URL | | ||
| |---------|-----| | ||
| | User Interface | http://localhost:8080/ | | ||
| | Admin Panel | http://localhost:8000/admin/ | | ||
| | API Documentation | http://localhost:8000/api/docs/swagger/ | | ||
|
|
||
| Log in using the credentials you created with `createsuperuser`. | ||
|
|
||
| ### Stop the Services | ||
|
|
||
| Press `Ctrl+C` in the terminal running `docker compose up`, or run: | ||
|
|
||
| ```bash | ||
| docker compose stop | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Application Maintenance | ||
|
|
||
| When new package dependencies or database schema changes occur, update your development environment: | ||
|
|
||
| ```bash | ||
| # Pull latest base images | ||
| docker compose pull | ||
|
|
||
| # Rebuild containers (no cache) | ||
| docker compose build --pull --no-cache | ||
|
|
||
| # Apply any new migrations | ||
| docker compose run --rm django python manage.py migrate | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Container Build Failures | ||
|
|
||
| If you encounter build errors related to Python packages: | ||
|
|
||
| 1. **Clear Docker build cache:** | ||
| ```bash | ||
| docker compose build --no-cache | ||
| ``` | ||
|
|
||
| 2. **Prune unused Docker resources:** | ||
| ```bash | ||
| docker system prune -a | ||
| ``` | ||
|
|
||
| ### Database Connection Issues | ||
|
|
||
| Ensure PostgreSQL is running and healthy: | ||
|
|
||
| ```bash | ||
| docker compose ps | ||
| docker compose logs postgres | ||
| ``` | ||
|
|
||
| ### Port Conflicts | ||
|
|
||
| If ports 8000, 8080, 5432, or 9000 are in use, modify the port mappings in `docker-compose.override.yml`. | ||
|
|
||
| ### GPU Not Available | ||
|
|
||
| If you see an error like: | ||
| ``` | ||
| Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu]] | ||
| ``` | ||
|
|
||
| This means GPU mode was requested but NVIDIA drivers aren't available. Use the default CPU mode instead: | ||
| ```bash | ||
| docker compose up | ||
| ``` | ||
|
|
||
| GPU acceleration is optional and only needed for accelerated inferencing. | ||
|
|
||
| ### Windows-Specific Issues | ||
|
|
||
| **Interactive commands don't work or hang:** | ||
|
|
||
| On Windows (especially Git Bash/MINGW), interactive Docker commands like `createsuperuser` may hang or fail to display prompts. Prefix the command with `winpty`: | ||
|
|
||
| ```bash | ||
| winpty docker compose run --rm -it django python manage.py createsuperuser | ||
| ``` | ||
|
|
||
| **"No such container" errors:** | ||
|
|
||
| If you see errors like `No such container: django` when trying to attach to a running container, use `docker compose run` instead: | ||
|
|
||
| ```bash | ||
| docker compose run --rm -it django python manage.py <command> | ||
| ``` | ||
|
|
||
| This creates a new container instance rather than attaching to an existing one. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.