All Projects → climateconnect → climateconnect

climateconnect / climateconnect

Licence: AGPL-3.0 license
The global climate action web platform. 🌏

Programming Languages

typescript
32286 projects
python
139335 projects - #7 most used programming language
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects
Makefile
30231 projects

Projects that are alternatives of or similar to climateconnect

awesome-sustainability-jobs
Dev jobs in the sustainability sector
Stars: ✭ 149 (+231.11%)
Mutual labels:  sustainability, climate-change, climate-action
netpositive-money.github.io
Bitcoiners contributing to climate change solutions - the website
Stars: ✭ 17 (-62.22%)
Mutual labels:  climate, climate-change
trends.earth
trends.earth - measure land change
Stars: ✭ 69 (+53.33%)
Mutual labels:  climate, climate-change
patch-ruby
Patch's Ruby client library - https://www.patch.io
Stars: ✭ 50 (+11.11%)
Mutual labels:  climate, climate-change
hacktoberfest-2020
Let's tackle the Climate-Change together with Open-Source 🌍 + 👩‍💻
Stars: ✭ 23 (-48.89%)
Mutual labels:  climate, climate-change
pi-eco-indicator
Display at-a-glance data of carbon intensity or Octopus Agile prices on a Pimoroni Blinkt! display or a Pimoroni Inky pHAT display.
Stars: ✭ 15 (-66.67%)
Mutual labels:  climate, climate-change
Climate-Change-Datasets
Here is a list of Climate Change Public Datasets 🌦🌪🌫🌀💧🌊
Stars: ✭ 115 (+155.56%)
Mutual labels:  climate, climate-change
hockeystick
Download and Visualize Essential Global Heating Data in R
Stars: ✭ 42 (-6.67%)
Mutual labels:  climate, climate-change
carbon-footprint
Calculate your carbon footprint 🏭👣 from food, transport, purchases, fashion, electricity and digital activities like streaming, NFT or blockchain.
Stars: ✭ 59 (+31.11%)
Mutual labels:  sustainability, climate-change
cloud-carbon-footprint
Cloud Carbon Footprint is a tool to estimate energy use (kilowatt-hours) and carbon emissions (metric tons CO2e) from public cloud usage
Stars: ✭ 510 (+1033.33%)
Mutual labels:  sustainability, climate
regen-ledger
Blockchain for planetary regeneration
Stars: ✭ 154 (+242.22%)
Mutual labels:  sustainability, climate-change
openclimate-demo
Open Climate Repo
Stars: ✭ 54 (+20%)
Mutual labels:  climate, climate-change
blockchain-carbon-accounting
This project implements blockchain applications for climate action and accounting, including emissions calculations, carbon trading, and validation of climate claims. It is part of the Linux Foundation's Hyperledger Climate Action and Accounting SIG.
Stars: ✭ 123 (+173.33%)
Mutual labels:  climate, climate-change
hector
The Hector Simple Climate Model
Stars: ✭ 72 (+60%)
Mutual labels:  climate, climate-change
openair-cyan
DIY small-scale open hardware direct air carbon capture device called Cyan. Our documentation is on https://openair-collective.github.io/openair-cyan
Stars: ✭ 54 (+20%)
Mutual labels:  climate, climate-change
ClimateChangeProjections
An embeddable map that shows climate change projections. How hot will it be by 2070 if we don't do something about it? Accessible at https://climatechange.codeforafrica.org
Stars: ✭ 29 (-35.56%)
Mutual labels:  climate, climate-change
awesome-green-software
No description or website provided.
Stars: ✭ 209 (+364.44%)
Mutual labels:  sustainability, climate
Electricitymap Contrib
A real-time visualisation of the CO2 emissions of electricity consumption
Stars: ✭ 2,138 (+4651.11%)
Mutual labels:  sustainability, climate-change
operatorfabric-core
Main operatorfabric program
Stars: ✭ 29 (-35.56%)
Mutual labels:  platform, collaboration
Canvas
A Laravel publishing platform
Stars: ✭ 2,838 (+6206.67%)
Mutual labels:  platform

Climate Connect

The client and server code for the web platform on https://climateconnect.earth.

Development setup

Climate Connect depends on PostgreSQL/PostGIS and Redis.

We use Python/Django for our backend and Next.js for the frontend.

Note: we use Python 3, so for all instructions we assume python means python3.

First, clone the GitHub repository

git clone https://github.com/climateconnect/climateconnect

One-click setup using VSCode Dev Containers

VSCode Dev Containers allow deploying a development environment including using Docker independent of the host operating system or installed programs.

Make sure you have the Remote Development Extension Pack VSCode extension installed.

  1. Open the repo in VS Code

  2. Start Docker (if it's not running)

  3. Run the command "Reopen in Container"

  4. Wait for it to be done setting up the Dev Container and running the setup scripts. This will take 1-5 minutes the first time and 10 seconds after that. It should look something like this:

  5. Start the frontend dev server using cd frontend && yarn dev

  6. Start the backend server using cd backend && make start. If you get a "Django is not installed" error run Ctrl+Shift+P (or Cmd+Shift+P) "Select Python interpreter" -> Recommended so it uses the Python venv.

  7. Open http://localhost:3000

You can get a Redis REPL using redis-cli -h redis and a PostgreSQL REPL using psql.

Manual Setup

If you can't or don't want to use VS Code dev containers, follow the steps below.

Postgres

  1. Create a local Postgres database with your own username and password. E.g., createdb climateconnect-dev.
  2. Install PostGIS on your local machine.
  3. Create the PostGIS extension within that database: run CREATE EXTENSION postgis;.

You will connect to this for your local backend project.

  • Create a new superuser
  • Alter your new user's password
  • Create a new database

Supply these values to your local backend/.backend_env.

Docker

We use Docker to run the local Redis server. See the Docker install docs if you don't have it.

Make sure to install docker-ce, docker-ce-cli, containerd.io, and docker-compose.

Project Dependencies

Run ./install_deps.sh to install the JavaScript dependencies and the Python dependencies in a virtualenv.

Backend

First Time Setup

  1. Go to backend directory: cd backend
  2. Run make install to install all backend libraries.
  3. Create .backend_env to set environment variables.
  4. Run make migrate to run Django migrations.
    • Note: This command is used for when you first start, or whenever you are adding or updating database models.
  5. Create a superuser using python manage.py createsuperuser
    • You can then access your admin panel via <API_URL>/admin/

Continual Development

  1. Ensure Docker is running and then run sudo docker-compose up. This will start a Redis server on Docker.
  2. Ensure the Postgres server is running.
  3. Run server using make start.
  4. Run Celery using celery -A climateconnect_main worker -l INFO

Creating and Removing Test Data

If test data is needed, run

python manage.py create_test_data --number_of_rows 4

If you need to wipe your local database and start over, run

sudo -u postgres psql  # note this might differ slightly in name based on your postgres setup

And then at the psql prompt,

postgres-# \list

to show available databases. Once you've identified the Climate Connect database name (e.g. we'll call it $DATABASE_NAME), you can,

postgres-# \connect $DATABASE_NAME
$DATABASE_NAME-# \dt
$DATABASE_NAME-# DROP SCHEMA public CASCADE;
$DATABASE_NAME-# CREATE SCHEMA public;
$DATABASE_NAME-# \q

Then run

make migrate

to update your migrations, and

python manage.py createsuperuser

to re-create a super user to be used in the Django admin panel.

Testing and Code Health

For unit tests, to run the test suite use:

make test

Or a specific test file or test class:

python manage.py test <file_path> or <file_path + class_name>

For linting, we use flake8. Lint with

make lint

For formatting, we use Black. Format a specific file with

make format path_to_file

or a directory with

make format directory

More configuration for Black can be found in the pyproject.toml file.

Frontend

  1. cd frontend.
  2. yarn to download all npm packages.
  3. Add a .env file for frontend environment variables. You can find variables you need to set in /frontend/next.config.js/

For local development, use the following for .env:

API_HOST="localhost"
API_URL="http://127.0.0.1:8000"
BASE_URL_HOST="localhost"
SOCKET_URL="ws://localhost"
ENVIRONMENT="development"

Note: This is for people who are using newer version of node (v17.0.1) or have new apple M1 devices. Before running yarn dev, please run this command export NODE_OPTIONS=--openssl-legacy-provider. You can save this in your ~/.zshrc file as well.

And finally yarn dev to spin up the Next.js app! Check out our frontend (FE) code style guidelines wiki to follow codebase best practices and contribute to a healthy and maintainable codebase.

Testing and Code Health

For unit tests, we use Jest. Write test files with .test.js and execute them directly with

yarn jest path/to/testfile.test.js

For linting, we use eslint. Watch files to fix lint issues with

yarn lint:watch

For formatting, we use prettier. Format with

yarn format

See npm scripts in package.json for more.

You can analyze size of the (frontend) bundle with

yarn analyze-bundle

Deploy

Currently the project is utilizing credits to deploy onto Azure. That deployment utilizes the two scripts in the root of the project, start_backend.sh and start_frontend.sh.

Frontend

Option 1: GitHub Actions

  1. Use GitHub actions to push to a server. A deploy file can be found in .github/workflows

Option 2: Manually

  1. cd frontend
  2. yarn --production
  3. yarn build
  4. node server.js OR next start

Backend

  1. Make sure your ENVIRONMENT env variable is set to production when deploying to the production server
  2. Follow steps 1-5 of the "Getting started locally - backend" (above in this file)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].