Skip to content

Commit eb46b68

Browse files
authored
Merge pull request #259 from dwreeves/dev
Update
2 parents 36c3678 + f081fc1 commit eb46b68

File tree

7 files changed

+21
-79
lines changed

7 files changed

+21
-79
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This code base is built in Python 3.10+ and utilizes the Flask library heavily.
2121
```shell
2222
docker compose build
2323
docker compose up -d
24-
docker compose exec flask update-db
24+
docker compose exec web flask update-db
2525
docker compose up
2626
```
2727

-366 KB
Binary file not shown.

app/templates/about.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,14 @@ <h2>Predictive Models</h2>
6060
data from two USGS stream gauges located in Waltham and Brookline.</a>
6161
</p>
6262
<h2>Credits</h2>
63-
<!-- <img class="auth-img" src="{{ url_for('static', filename='images/daniel_reeves_photo.jpg') }}" alt="Photo of Daniel Reeves near the Charles river." /> -->
6463
<p>
6564
This website was built by volunteers at <a href="https://www.codeforboston.org/">Code for Boston</a> in
6665
collaboration with the Charles River Watershed Association, and is currently maintained on a volunteer
6766
basis by <a href="https://www.linkedin.com/in/daniel-reeves-27700545/" target="_blank">Daniel Reeves</a>,
6867
a former project leader at Code For Boston.
6968
</p>
7069
<p>
71-
The predictive model currently being used for the flagging program website was developed and deployed by <a href="https://www.linkedin.com/in/laura_xia">Laura Xia</a>
70+
The predictive model currently being used for the flagging program website was developed and deployed by <a href="https://www.linkedin.com/in/laura_xia" target="_blank">Laura Xia</a>
7271
(MIT, class of 2026).
7372
<!-- She has updated the model with new data to reflect the changing conditions of the Charles River. -->
7473

app/templates/index.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ <h2>Stay Updated</h2>
4545
</p>
4646
<p>
4747
You can also <a href="https://twitter.com/crwaflagging">follow the CRWA Flagging Program on Twitter</a> to get
48-
automated updates from this website. Our Twitterr bot posts automatic updates every time the predictive model is run.
48+
automated updates from this website.
4949
</p>
50-
<div class="centered">
51-
<a class="twitter-timeline" data-lang="en" data-width="400" data-height="400" href="https://twitter.com/crwaflagging?ref_src=twsrc%5Etfw">Tweets by crwaflagging</a>
52-
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
53-
</div>
5450
{% endblock %}

requirements.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ sentry-sdk[flask]
3434
tenacity
3535
tweepy
3636

37+
# https://github.com/pallets-eco/flask-admin/issues/2548
38+
wtforms==3.1.2
39+
3740
# ==========================================================
3841
# Testing
3942
# ==========================================================

requirements.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ fqdn==1.5.1
110110
# via jsonschema
111111
graphql-core==3.2.5
112112
# via hypothesis-graphql
113+
greenlet==3.1.1
114+
# via sqlalchemy
113115
gunicorn==23.0.0
114116
# via -r requirements.in
115117
h11==0.14.0
@@ -377,7 +379,9 @@ werkzeug==3.1.3
377379
# via
378380
# flask
379381
# schemathesis
380-
wtforms==3.2.1
381-
# via flask-admin
382+
wtforms==3.1.2
383+
# via
384+
# -r requirements.in
385+
# flask-admin
382386
yarl==1.17.2
383387
# via schemathesis

run

Lines changed: 9 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,8 @@
22

33
set -eo pipefail
44

5-
DC="${DC:-exec}"
6-
7-
# If we're running in CI we need to disable TTY allocation for docker-compose
8-
# commands that enable it by default, such as exec and run.
9-
TTY=""
10-
if [[ ! -t 1 ]]; then
11-
TTY="-T"
12-
fi
13-
14-
# -----------------------------------------------------------------------------
15-
# Helper functions start with _ and aren't listed in this script's help menu.
16-
# -----------------------------------------------------------------------------
17-
18-
function _dc {
19-
docker compose --env-file .env "${DC}" ${TTY} "${@}"
20-
}
21-
22-
function _build_run_down {
23-
docker compose build
24-
docker compose run ${TTY} "${@}"
25-
docker compose down
26-
}
5+
# shellcheck disable=SC2046
6+
export $(grep -v '^#' .env | xargs)
277

288
# -----------------------------------------------------------------------------
299

@@ -41,12 +21,12 @@ function ssl-cert {
4121

4222
function cmd {
4323
# Run any command you want in the web container
44-
_dc web "${@}"
24+
docker compose exec web "${@}"
4525
}
4626

4727
function flask {
4828
# Run any Flask commands
49-
cmd flask "${@}"
29+
docker compose exec web flask "${@}"
5030
}
5131

5232
function lint:dockerfile {
@@ -57,68 +37,28 @@ function lint:dockerfile {
5737

5838
function lint {
5939
# Lint Python code
60-
cmd ruff check "${@}"
40+
docker compose exec web ruff check "${@}"
6141
}
6242

6343
function test {
6444
# Run test suite
65-
cmd python -m pytest "${@}"
45+
docker compose exec web python -m pytest "${@}"
6646
}
6747

6848
function shell {
6949
# Start a shell session in the web container
70-
cmd bash "${@}"
50+
docker compose exec web bash "${@}"
7151
}
7252

7353
function psql {
7454
# Connect to PostgreSQL
7555
# shellcheck disable=SC1091
76-
. .env
77-
docker compose --env-file .env exec -i --tty postgres psql -U "${POSTGRES_USER}" "${@}"
78-
}
79-
80-
function bash {
81-
docker compose --env-file .env exec --tty -i web /bin/bash
56+
docker compose exec postgres psql -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" "${@}"
8257
}
8358

8459
function redis-cli {
8560
# Connect to Redis
86-
_dc redis redis-cli "${@}"
87-
}
88-
89-
function ci:install-deps {
90-
# Install Continuous Integration (CI) dependencies
91-
sudo apt-get install -y curl shellcheck
92-
sudo curl \
93-
-L https://raw.githubusercontent.com/nickjj/wait-until/v0.2.0/wait-until \
94-
-o /usr/local/bin/wait-until && sudo chmod +x /usr/local/bin/wait-until
95-
}
96-
97-
function ci:test {
98-
# Execute Continuous Integration (CI) pipeline
99-
#
100-
# It's expected that your CI environment has these tools available:
101-
# - https://github.com/koalaman/shellcheck
102-
# - https://github.com/nickjj/wait-until
103-
shellcheck run bin/*
104-
lint:dockerfile "${@}"
105-
106-
cp --no-clobber .env.example .env
107-
cp --no-clobber docker-compose.override.yml.example docker-compose.override.yml
108-
109-
docker-compose build
110-
docker-compose up -d
111-
112-
# shellcheck disable=SC1091
113-
. .env
114-
wait-until "docker-compose exec -T \
115-
-e PGPASSWORD=${POSTGRES_PASSWORD} postgres \
116-
psql -U ${POSTGRES_USER} ${POSTGRES_USER} -c 'SELECT 1'"
117-
118-
lint "${@}"
119-
format --check
120-
flask db reset --with-testdb
121-
test "${@}"
61+
docker compose exec redis redis-cli "${@}"
12262
}
12363

12464
function help {

0 commit comments

Comments
 (0)