Skip to content
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

Update Dependencies and Make Generic for Any City #183

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Push Images to GHCR

on:
push:
branches:
- master
tags:
- v*
pull_request:
branches:
- master
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push-recycling-image:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
node_modules
npm-debug.log
env.sh
package-lock.json

11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:18

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

CMD [ "node", "server.js" ]
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
My Building Doesn't Recycle
===========================

Crowdsourcing data about which residential buildings do not have recycling in Chicago
Crowdsourcing data about which residential buildings do not have recycling in a given area. I am attempting to modify this fork to be generic, so instead of being Chicago-centric, it is possible to deploy this application for a new city looking to document recycling needs.

The app can currently be found at http://mybuildingdoesntrecycle.com
The app can currently be found at http://recycling.samacohen.com

Requirements
Dependencies
------------

* [Node.js](http://nodejs.org/)
* [MongoDB](http://docs.mongodb.org/manual/)
* [Memcached](http://memcached.org/)

Running Your Own Instance
--------------------------------
If you'd like to run your own instance for your city, you can fork this repository and change the [configs](./config/) to make sense for your city. You can then push up a new branch, and trigger a GitHub Actions build for the branch. Then, if you also modify the [docker-compose.yml](./docker-compose.yml) file to point to your branch name, you can start the instance by simply running `docker compose up` once you've copied the compose file down. See the [denver](https://github.com/samc1213/recycling/tree/denver) branch for an example.

Getting Started
---------------
For more detailed instructions see the [wiki](https://github.com/open-city/recycling/wiki)
The server runs on port 3000 by default, so visit [http://localhost:3000](http://localhost:3000) in your browser to view it.

* install dependencies
`npm install`
* Run the schema migrations
`npm migrate:all`
* Run `mongod` and `memcached` on default ports
* run the app
`node server.js`
* Then visit [http://localhost:3000](http://localhost:3000) in your browser.
Getting Started With Development
--------------------------------
To start developing, first install Docker and [Docker Compose](https://docs.docker.com/compose/install/). Then run:

```bash
docker compose -f docker-compose.dev.yml up --build
```

The `docker-compose.dev.yml` file maps the repository to the docker container, so any client-side changes will be reflected immediately. Any changes to the node server itself will require a restart of the recycling container, which can be done with `docker compose -f docker-compose.dev.yml restart recycling`.

To clean all the data from the mongoDB database, you can run `docker compose -f docker-compose.dev.yml down -v`

Tests
-----
Expand Down
21 changes: 21 additions & 0 deletions config/about.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<h2>What is this site for and who made it?</h2>
<p><em>My Building Doesn’t Recycle!</em> is a web app that allows multi-unit renters (renters in buildings with 5 or more units) to report that they do not have recycling in their building. This site was created by <a href='http://clairemicklin.com' target='_blank'>Claire Micklin</a>, <a href='http://benwilhelm.com' target='_blank'>Ben Wilhelm</a>, and <a href='https://github.com/alexkahn' target='_blank'>Alex Kahn</a> at <a href='http://opengovhacknight.org/' target='_blank'>Open Government Hack Night</a>.</p>

<p>Upgraded Mapbox and Google API licenses were generously donated by <a href='http://www.smartchicagocollaborative.org/' target='_blank'>Smart Chicago Collaborative</a>. The Smart Chicago Collaborative offers <a href='http://www.smartchicagocollaborative.org/work/ecosystem/developer-resources/' target='_blank'>free developer resources</a> for qualifying civic innovation projects.</p>

<h2>Why do we need this site?</h2>
<p>In 1994, the city of Chicago passed the <a target='_blank' href='http://www.amlegal.com/nxt/gateway.dll/Illinois/chicago_il/title11utilitiesandenvironmentalprotecti/chapter11-5reductionandrecyclingprogram?f=templates$fn=default.htm$3.0$vid=amlegal:chicago_il$anc=JD_11-5-021'>Chicago High Density Residential and Commercial Source Reduction and Recycling Ordinance</a>, commonly known as the Burke-Hansen ordinance, that stated that multi-unit/high-density residents must have adequate access to refuse and recycling disposal. With the completion rollout of the city of Chicago&#039;s Blue Cart program in early 2014, people who live in single-family homes and apartment buildings with 4 or fewer units now do have access to recycling services. Yet, there is still no equivalent service for multi-unit (5+ unit) buildings.</p>

<p>In order to provide recycling services to tenants, landlords in multiunit buildings must contract with a private recycling hauler, and it costs extra money on top of the solid waste disposal fees they already pay. Since the multi-unit recycling ordinance is not enforced, most multiunit landlords opt not to provide recycling services to their tenants. And since the city does not enforce the Burke-Hansen law, there is no channel for multi-unit dwellers to report a lack of recycling services in their building. Thus, it is very hard to determine how much recycling <em>isn&#039;t</em> happening.</p>

<h2>What will you do with the data?</h2>
<p>The data will help us to visualize reports of recycling noncompliance and provide a hub for residents of multi-unit buildings and other Chicago residents to have a collective voice in favor of more comprehensive recycling services. Our group plans to use the visualizations as a tool for advocacy and to push for the strengthening and enforcement of the Burke-Hansen Ordinance.</p>

<h2>How can I help?</h2>

<p>You can report your building if it does not have recycling.</p>
<p><a href='/' class='btn btn-primary'>Report your building</a></p>

<h3>Get Involved</h3>
<p>You can also visit our <a href="/get-involved">Get Involved</a> page. There you can write a letter to your alderman and tell them to push the city to enforce the recycling law. You can also find out where to recycle if your building does not provide recycling services.</p>
</div>
19 changes: 0 additions & 19 deletions config/config.json

This file was deleted.

58 changes: 58 additions & 0 deletions config/getinvolved.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@

<p>Besides <a href='/' title='Report Your Building'>reporting your building</a>, there are many ways to promote and participate in recycling in your 5+-unit building:</p>

<h3>Contact your alderman</h3>

<p>Email or call your alderman and tell them you want the city to enforce the existing recycling laws. The city provides a <a href='https://chicago.legistar.com/People.aspx' target='_blank'>sortable list of aldermen</a> and their wards. If you don't know which ward you live in, you can input your address and search for your ward.</p>

<p>Need ideas for what to write to your alderman? Below is a sample letter that you can copy.</p>

<button class="btn btn-primary" type="button" data-toggle="collapse" data-target="#letterExample" aria-expanded="false" aria-controls="letterExample">
View a sample letter to your Alderman
</button>
<div class="collapse" id="letterExample">
<div class="well">
<p>Dear Alderman _________,</p>

<p>
It is time for Chicago to live up to its claims of being a green city and take steps to create a truly effective and comprehensive recycling program. For over 20 years, there has been a law on the books (The Chicago High Density Residential and Commercial Source Reduction and Recycling Ordinance) that requires owners, governing associations or condominium boards of buildings with 5 or more units to establish an effective recycling program for their properties. Unfortunately, the city rarely enforces this ordinance, and thus many properties subject to the ordinance are out of compliance and fail to provide recycling services to tenants.
</p>

<p>
Properties subject to the Ordinance account for more than double the waste generated at all Chicago properties and so until these properties are required to recycle, Chicago's recycling program will continue to be incomplete and ineffective. One simple step you could take would be to advocate for the immediate enforcement of the Chicago High Density Residential and Commercial Source Reduction and Recycling Ordinance (The Burke-Hansen Ordinance). The Ordinance mandates that properties are fined $25 to $100 for each day they are out of compliance with the law. The money raised from imposing the fines could be used to pay for a city agent that educates about and enforces the ordinance.
</p>

<p>
The city of Chicago has a long way to go to catch up with other major U.S. cities that offer complete and effective recycling programs. By choosing to enforce a recycling law that has been on the books for decades, the city can take the first step towards building a recycling program that allows all residents to participate. Enforcing the ordinance sends the message that recycling is important to the environmental, economic and reputational well-being of the city and can only serve to make Chicago a truly world class city.
</p>

<p>Sincerely,</p>

<p>Your Name</p>
<p>Your Address</p>
</div>
</div>

<h3>Start your own program</h3>

<p>View the City of Chicago's guide to <a href='http://www.cityofchicago.org/city/en/depts/streets/supp_info/recycling1/muti-unit_residentialrecycling5stepprocess.html'>starting a recycling program</a> in your building.</p>

<h3>Drop it off</h3>

<p>Take your recycling to <a href='http://www.chicagorecyclingcoalition.org/resources-dropoff-centers.html'>one of the city's drop-off centers.</a></p>

<h3>Learn how to recycle</h3>
<p>
The City of Chicago's <a href="http://www.recyclebycity.com/chicago">Recycle by City</a> website lists which materials can be recycled in Blue Carts. Private recycling haulers (which service buildings with 5 or more units) may accept different materials, but this site is a good starting point.
</p>
<div>
<h3>Share this site with your friends</h3>
<div class="social-links">
<div class="fb-share-button share-button" data-href="http://mybuildingdoesntrecycle.com" data-layout="button_count"></div>
<div class="twitter-share-wrapper share-button">
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://mybuildingdoesntrecycle.com" data-text="Hey Chicago! Does your building provide adequate recycling?">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
</div>
<div class="clear"></div>
</div>
</div>
6 changes: 6 additions & 0 deletions config/public/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cityname": "Chicago",
"cityresidentname": "Chicagoan",
"stateabbrev": "IL",
"citycentercoordinates": [41.881, -87.629]
}
7 changes: 7 additions & 0 deletions config/public/welcomemessage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Chicago law](https://www.chicago.gov/city/en/depts/streets/supp_info/construction_demolitionsites0.html) requires buildings with 5 or more residential units to provide recycling services to occupants.

However, the City of Chicago does not enforce this law—and this leads many landlords NOT to provide recycling services to tenants.

Add your report to our registry to show that your building does not recycle.

Your report shows that many buildings are NOT offering recycling and that Chicagoans support stronger recycling laws.
29 changes: 29 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: '3.8'

services:
recycling:
build:
context: .
ports:
- 3000:3000
environment:
- PORT=3000
- MONGO_URI=mongodb://mongo:27017/recycling_development
- MEMCACHE_SERVERS=memcached:11211
volumes:
- ./:/app
- /app/node_modules
command: node server.js

mongo:
image: mongo:7.0.0
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb

memcached:
image: memcached:1.6.14

volumes:
mongodb:
mongodb_config:
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'

services:
recycling:
image: ghcr.io/samc1213/recycling:latest
ports:
- 3000:3000
environment:
- PORT=3000
- MONGO_URI=mongodb://mongo:27017/recycling_production
- MEMCACHE_SERVERS=memcached:11211
command: node server.js

mongo:
image: mongo:7.0.0
volumes:
- mongodb:/data/db
- mongodb_config:/data/configdb

memcached:
image: memcached:1.6.14

volumes:
mongodb:
mongodb_config:
7 changes: 0 additions & 7 deletions gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
'use strict';

module.exports = function (grunt) {
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
migrations: {
path: __dirname + '/migrations',
template: grunt.file.read( __dirname + "/migrations/_template.js"),
mongo: process.env.MONGOLAB_URI || 'mongodb://localhost/recycling_' + process.env.NODE_ENV,
ext: 'js'
},
jshint: {
files: ['public/js/*.js'],
options: {
Expand Down
15 changes: 0 additions & 15 deletions lib/transporter.js

This file was deleted.

Loading