Skip to content

Improve urban food distribution by connecting community gardeners with pickers 🍆

License

Notifications You must be signed in to change notification settings

HarvestHub/GardenHub

Repository files navigation

GardenHub Promo Banner

Build Status Coverage Status Maintainability Known Vulnerabilities Requirements Status Documentation Status Docker Automated build License: AGPL v3 Matrix ID

GardenHub

Formed around the simple idea that food should not go to waste, GardenHub is the solution to the problem of community garden food waste. Despite the best efforts of community gardeners, far too often food produced in community gardens rots on the vine.

GardenHub is building technology to enable gardeners to collaborate and act upon what's growing, ripening, and available for harvest in their gardens. Using this information, GardenHub notifies gardeners, local charities, restaurants, and other stakeholders of the availability of this food.

Read the full documentation on Read the Docs.

Local development

GardenHub provides a script called dev.sh to make local development easy. As long as you have Docker installed, you do not need Python, Django, Postgres, or anything else running on your computer for local development with dev.sh. This is because dev.sh automatically configures a local development environment with Docker containers where all of that is already installed.

Note: This has been tested on GNU/Linux. Your mileage may vary using Docker on other operating systems.

You will need the following packages installed to develop on GardenHub:

  • docker-ce
  • docker-compose
  • git
  • bash

Installing Docker

To check if you already have Docker installed, run docker -v in your terminal. GardenHub has been tested with version 17. If you already have it, skip to the next section.

asciicast

On most GNU/Linux distros, you can use the following command to install Docker:

sudo sh -c "wget -nv -O - https://get.docker.com/ | sh"

After Docker is installed, you'll want to add your user to the docker group so you don't need sudo to run Docker commands.

sudo usermod -aG docker $(whoami)

Finally, log out and back into your computer, and then head to the next section.

Installing Docker Compose

You will also need Docker Compose for local development. Check if you already have it by typing docker-compose version.

If you need to install it, follow the link and select your platform for specific instructions.

Starting the development server

asciicast

With Docker installed and ready to go, just follow these commands:

# Clone the repo
git clone https://github.com/HarvestHub/GardenHub.git

# Enter the project folder
cd GardenHub

# Run the local development server
./dev.sh start

It may take a few minutes to download everything the first time, then it will run more quickly on subsequent attempts.

dev.sh has a few options you can take advantage of.

Command Description
start Launches a Postgres container and a GardenHub app container then starts manage.py runserver.
build Rebuilds the app container. You must do this manually if you change requirements.txt.
manage.py Same as running python manage.py in the app container. Useful for running migrations and other management commands.
setup Installs Docker. Works on many GNU/Linux distros.
docs Runs a local server for editing the docs. Uses sphinx-autobuild within the container.

Hint: ./dev.sh start will run migrations every time before it starts the development server. To skip that, you can run ./dev.sh manage.py runserver to run the development server directly.

Running migrations and management commands

To run migrations, you can use:

# Migrate
./dev.sh manage.py migrate

# Make migrations
./dev.sh manage.py makemigrations

Any other management command may also be run this way.

Rebuilding the container (you have to, sometimes)

Changing application code shouldn't require rebuilding the container. However, you must manually rebuild the container any time you edit requirements.txt. This is because the requirements get installed into the container at build time. You can rebuild the container like so:

./dev.sh build

License

GardenHub is copyright © 2017 HarvestHub. Except where otherwise noted, the code in this repo is licensed under the GNU AGPL version 3 or later. View the LICENSE file for a copy of the full license.

The documentation (in the docs subdirectory) is licensed under the GNU FDL version 1.3 or greater. View docs/LICENSE for a copy of the full license.

Finally, the file gardenhub/templates/gardenhub/email_invitation.html is copyright Lee Munroe and licensed under MIT. The copyright notice and full license text is inside of the source code of the file.