{"id":43657160,"url":"https://github.com/christophermarais/barkandambrosiagallery","last_synced_at":"2026-03-16T06:19:00.642Z","repository":{"id":329183037,"uuid":"1118376120","full_name":"ChristopherMarais/barkandambrosiagallery","owner":"ChristopherMarais","description":"This is the development code for the webapp barkandambrosiagallery.org. It relies on the IBBI python package for AI. ","archived":false,"fork":false,"pushed_at":"2026-02-03T02:56:50.000Z","size":31702,"stargazers_count":4,"open_issues_count":34,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-03T08:37:26.575Z","etag":null,"topics":["ai","biology-images","cloud-computing","computer-vision","docker","gpu-acceleration","pixi","taxonomy"],"latest_commit_sha":null,"homepage":"https://www.barkandambrosiagallery.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChristopherMarais.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-17T16:55:59.000Z","updated_at":"2026-02-03T02:56:50.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ChristopherMarais/barkandambrosiagallery","commit_stats":null,"previous_names":["christophermarais/barkandambrosiagallery"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ChristopherMarais/barkandambrosiagallery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherMarais%2Fbarkandambrosiagallery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherMarais%2Fbarkandambrosiagallery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherMarais%2Fbarkandambrosiagallery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherMarais%2Fbarkandambrosiagallery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChristopherMarais","download_url":"https://codeload.github.com/ChristopherMarais/barkandambrosiagallery/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChristopherMarais%2Fbarkandambrosiagallery/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29096329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T21:00:18.276Z","status":"ssl_error","status_checked_at":"2026-02-04T20:59:11.235Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","biology-images","cloud-computing","computer-vision","docker","gpu-acceleration","pixi","taxonomy"],"created_at":"2026-02-04T21:02:07.851Z","updated_at":"2026-02-13T04:49:42.027Z","avatar_url":"https://github.com/ChristopherMarais.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bark and Ambrosia Beetle Gallery\n\nA dedicated web platform for storing, browsing, and managing large datasets of annotated images for **Bark and Ambrosia Beetles**.\n\n# Development Workflow\n\nThis guide covers how to set up the project, run it locally, make changes (Python, HTML, CSS), and share your work with the team.\n\n## **1. Prerequisites**\n\nBefore starting, ensure you have the following installed:\n\n* **Docker Desktop** (must be running)\n* **Git**\n* **(Optional)** [Pixi](https://prefix.dev/) (installed locally helps with managing `pixi.lock`, though Docker handles the runtime).\n\n---\n\n## **2. Initial Setup (First Time Only)**\n\nIf you are cloning this repository for the first time (or setting up a new machine), follow these steps to initialize the environment.\n\n1. **Clone the Repository**\n```bash\ngit clone https://github.com/your-org/beetlesgallery.git\ncd beetlesgallery\n\n```\n\n\n2. **Build the Environment**\nThis builds the Docker container and installs all Python (Pixi) and JavaScript (npm) dependencies.\n```bash\ndocker compose build\n\n```\n\n\n3. **Initialize the Database**\nRun the migrations to create the database schema.\n```bash\ndocker compose run --rm web pixi run migrate\n\n```\n\n\n4. **Create an Admin User**\nYou need this to access the upload tools and admin panel.\n```bash\ndocker compose run --rm web pixi run python manage.py createsuperuser\n\n```\n\n\n\n---\n\n## **3. Daily Development Cycle**\n\n### **Step A: Start the Server**\n\nTo view the website, start the containers. This runs the database and the Django web server.\n\n```bash\ndocker compose up\n\n```\n\n* **View the site:** [http://localhost:8000](https://www.google.com/search?q=http://localhost:8000)\n* **Stop the site:** Press `Ctrl+C` in the terminal.\n\n### **Step B: Editing Code (Python \u0026 HTML)**\n\n* **Hot Reloading:** The project is configured to \"watch\" your folders. If you edit any `.py` file (views, models) or `.html` template, the server will automatically reload. You just need to refresh your browser.\n\n### **Step C: Editing Styles (Tailwind CSS)**\n\nBecause we use Tailwind, changing classes in HTML (e.g., `text-red-500` to `text-blue-500`) requires recompiling the CSS file.\n\n1. Open a **new terminal** window (keep `docker compose up` running in the first one).\n2. Run the CSS watcher:\n```bash\ndocker compose run --rm web pixi run build-css\n\n```\n\n\n* *Note: This command runs in \"watch mode\" (it will stay open).*\n* As you save HTML or JS files, you will see it regenerate `style.css` instantly.\n\n\n\n### **Step D: Modifying the Database (Models)**\n\nIf you edit `models.py` (e.g., adding a new field to `Beetles`), you must update the database schema.\n\n1. **Create Migration File:**\n```bash\ndocker compose run --rm web pixi run python manage.py makemigrations\n\n```\n\n\n2. **Apply Migration:**\n```bash\ndocker compose run --rm web pixi run migrate\n\n```\n\n\n\n### **Step E: Adding New Dependencies**\n\n* **Python:** Add the package to `pixi.toml` under `[dependencies]`.\n* Run `pixi install` locally (if you have Pixi) to update `pixi.lock`.\n* Run `docker compose build` to rebuild the container with the new library.\n\n\n* **JavaScript:** Edit `package.json`.\n* Run `docker compose build` to update.\n\n\n\n---\n\n## **4. Sharing Your Changes (Git Workflow)**\n\nOnce you are happy with your changes and have tested them at `localhost:8000`:\n\n1. **Check Status:**\nSee which files you changed.\n```bash\ngit status\n\n```\n\n\n2. **Add \u0026 Commit:**\n```bash\ngit add .\ngit commit -m \"Description of what I changed (e.g., Fixed sidebar layout)\"\n\n```\n\n\n3. **Pull Updates (Important):**\nBefore pushing, always pull the latest code from your collaborators to avoid conflicts.\n```bash\ngit pull origin main\n\n```\n\n\n* *If there are new dependencies in the update, run `docker compose build` again.*\n* *If there are database changes, run `docker compose run --rm web pixi run migrate`.*\n\n\n4. **Push:**\n```bash\ngit push origin main\n\n```\n\n\n\n---\n\n## **5. Cheat Sheet (Commands)**\n\n| Goal | Command |\n| --- | --- |\n| **Start Site** | `docker compose up` |\n| **Watch CSS** | `docker compose run --rm web pixi run build-css` |\n| **Apply DB Changes** | `docker compose run --rm web pixi run migrate` |\n| **Create Migration** | `docker compose run --rm web pixi run python manage.py makemigrations` |\n| **Create Admin (Locally)** | `docker compose run --rm web pixi run python manage.py createsuperuser` |\n| **Create Admin (Server)** | `docker compose -f docker-compose.yml -f docker-compose.prod.yml exec -it web pixi run python manage.py createsuperuser` |\n| **Rebuild Container** | `docker compose build` |\n| **Run Arbitrary Command** | `docker compose run --rm web pixi run python manage.py \u003ccommand\u003e` |\n| **Rebuild CSS** | `docker compose run --rm web pixi run npx tailwindcss -i ./beetlesgallery/static/css/input.css -o ./beetlesgallery/static/css/style.css --watch` |\n| **Rebuild Taxonomy Tree** | `docker compose run --rm web pixi run python manage.py build_taxonomy_tree` |\n\n\n# Server \u0026 Deployment Guide (Contabo)\n\n## 1. Connecting to the Server\n\nWe use SSH (Secure Shell) to connect to the remote Contabo server.\n\n* **Host IP:** `Ask for the IP address`\n* **User:** `root`\n* **Project Location:** `/root/barkandambrosiagallery`\n* **Data Location (Persistent):** `/root/barkandambrosia_data`\n\n### How to Connect\n\nOpen your terminal (Mac/Linux) or PowerShell (Windows) and run:\n\n```bash\nssh root@Ask for the IP address\n\n```\n\n*(If you set up an SSH key, this will log you in automatically. Otherwise, enter the root password).*\n\n---\n\n## 2. Debugging \u0026 Maintenance\n\nOnce logged in, navigate to the project folder:\n\n```bash\ncd /root/barkandambrosiagallery\n\n```\n\n### Viewing Logs (The most important command)\n\nIf the website crashes (Error 500/502), check the logs to see the Python traceback.\n\n```bash\n# View web logs (scrolling real-time)\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml logs -f web\n\n# View database logs\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml logs -f db\n\n```\n\n*Press `Ctrl+C` to exit the log view.*\n\n### Restaring the Server\n\nIf something is stuck or you changed `.env.prod`:\n\n```bash\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml restart\n\n```\n\n### Entering a Container (SSH into the container)\n\nIf you need to run manage.py commands manually (like creating a superuser):\n\n```bash\n# Run a temporary container to execute a command\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm web pixi run python manage.py \u003cCOMMAND\u003e\n\n# Example: Create Superuser\ndocker compose -f docker-compose.yml -f docker-compose.prod.yml run --rm web pixi run python manage.py createsuperuser\n\n```\n\n---\n\n## 3. Development vs. Production\n\nWe use a **\"Two-File Strategy\"** for Docker.\n\n1. `docker-compose.yml` (The Base / Development)\n2. `docker-compose.prod.yml` (The Production Override)\n\n| Feature | Development (Local Laptop) | Production (Contabo Server) |\n| --- | --- | --- |\n| **Command** | `docker compose up` | `docker compose -f docker-compose.yml -f docker-compose.prod.yml up -d` |\n| **Code Updates** | **Hot-Reloading:** Code is \"mounted\" (`.:/app`). Changes on your laptop appear instantly. | **Static Build:** Code is copied into the image. You must rebuild to see changes. |\n| **Debug Mode** | `True`: Shows detailed error pages. | `False`: Shows generic \"Server Error (500)\" for security. |\n| **Database** | Uses `devpass`. Data is stored in a Docker volume (hidden). | Uses **Secure Password** from `.env.prod`. Data is stored in `/root/barkandambrosia_data`. |\n| **Static Files** | Served by Django (slow, dev only). | Served by WhiteNoise/Gunicorn (optimized). |\n| **Ports** | `8000` and `5432` (DB) are open. | Only `8000` is open. Database port `5432` is closed for security. |\n\n### How the Files Work Together\n\n* **On your laptop:** Docker reads `docker-compose.yml` and ignores the prod file. It sees variables like `${POSTGRES_PASSWORD:-devpass}` and defaults to `devpass` because you have no `.env.prod`.\n* **On Contabo:** We explicitly tell Docker to use **both** files (`-f ... -f ...`). The `prod.yml` file overrides settings in the base file (like volume locations and commands). We also symlinked `.env` to `.env.prod` so Docker automatically fills in the secure passwords.\n\n---\n\n## 4. Deployment Workflow (GitHub Actions)\n\nYou do **not** need to manually update the server code.\n\n1. Make changes on your laptop.\n2. Push to the `main` branch on GitHub.\n3. **GitHub Actions** automatically:\n* Logs into Contabo.\n* Pulls the new code.\n* Rebuilds the Docker images.\n* Restarts the containers using the Production config.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophermarais%2Fbarkandambrosiagallery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophermarais%2Fbarkandambrosiagallery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophermarais%2Fbarkandambrosiagallery/lists"}