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

Merge and deploy latest #44

Open
wants to merge 81 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
c9178ca
add FAQs
ChrisSheng97 Apr 24, 2020
e58a8ca
Merge pull request #3 from cmu-delphi/dev
dfarrow0 Apr 24, 2020
feb860f
restore development-specific configuration
dfarrow0 Apr 24, 2020
43460e4
update dev readme
dfarrow0 Apr 24, 2020
e0625a2
Merge pull request #7 from dfarrow0/dev
undefx Apr 24, 2020
ad0a87a
use dev branch badge
dfarrow0 Apr 24, 2020
68f08ba
Merge pull request #10 from dfarrow0/dev
undefx Apr 24, 2020
4c40cbd
Update README.md
undefx Apr 25, 2020
e46227a
Update README.md
undefx Apr 25, 2020
e3e92bf
launch without forcing https
dfarrow0 Apr 28, 2020
a55767d
don't lookup nowcast, as it is unused
dfarrow0 Apr 28, 2020
6f657a8
use delphi-hosted epidata library
dfarrow0 Apr 28, 2020
d43ef45
remove the caching service worker
dfarrow0 Apr 28, 2020
a27efc0
get latest issue from epidata api
dfarrow0 Apr 28, 2020
b61eb03
update advanced preferences, fixes #12
dfarrow0 Apr 28, 2020
6f3f719
remove unused css-as-php files
dfarrow0 Apr 28, 2020
be9867e
grant access during local docker development
dfarrow0 Apr 28, 2020
965682a
database ddl and local docker development
dfarrow0 Apr 28, 2020
77d3729
Merge pull request #13 from dfarrow0/dev
undefx Apr 29, 2020
7ed7853
fix user registration
dfarrow0 May 2, 2020
7f8cb2d
Merge pull request #18 from dfarrow0/dev
undefx May 2, 2020
5c82fd0
Troubleshoot signup issues
korlaxxalrok May 4, 2020
56784f8
Merge pull request #20 from cmu-delphi/fix/signup-issue
korlaxxalrok May 4, 2020
8041e3a
Mmm...not it
korlaxxalrok May 4, 2020
454d483
Merge pull request #21 from cmu-delphi/fix/signup-issue
korlaxxalrok May 4, 2020
72fd1ac
Is it this...
korlaxxalrok May 4, 2020
8ad66f3
Merge pull request #22 from cmu-delphi/fix/signup-issue
korlaxxalrok May 4, 2020
ed0cb01
Comment out suspect function
korlaxxalrok May 4, 2020
f2a7ab3
Merge pull request #23 from cmu-delphi/fix/signup-issue
korlaxxalrok May 4, 2020
a53db35
Add $\dbh parameter to function call
korlaxxalrok May 5, 2020
2406cd4
Merge pull request #24 from cmu-delphi/fix/signup-issue
korlaxxalrok May 5, 2020
4c1e67e
Restore previously suspicious function
korlaxxalrok May 5, 2020
4426f79
Merge pull request #25 from cmu-delphi/fix/signup-issue
korlaxxalrok May 5, 2020
4fb91bf
Fix whitespace
korlaxxalrok May 5, 2020
9b098f5
Merge pull request #26 from cmu-delphi/fix/signup-issue
korlaxxalrok May 5, 2020
9047d63
Add missing argument to userAlreadyExist function
korlaxxalrok May 5, 2020
572763c
Merge pull request #27 from cmu-delphi/fix/signup-issue
korlaxxalrok May 5, 2020
301d6da
Add missing arg to function
korlaxxalrok May 5, 2020
575f6fe
Merge pull request #28 from cmu-delphi/fix/signup-issue
korlaxxalrok May 5, 2020
9448a7a
Add arg to function call
korlaxxalrok May 8, 2020
33e5be2
Merge pull request #33 from cmu-delphi/bgc/fix-user-registration-redux
korlaxxalrok May 8, 2020
f31e5aa
Remove Chris, add Brian
korlaxxalrok May 15, 2020
3179c08
Merge pull request #35 from cmu-delphi/chore/remove-chris-as-admin
korlaxxalrok May 15, 2020
13f271d
Merge pull request #4 from cmu-delphi/dev
dfarrow0 Oct 2, 2020
de76f34
ensure that files are readable
dfarrow0 Oct 5, 2020
f001003
Merge pull request #38 from dfarrow0/dev
krivard Oct 5, 2020
43aa58f
feat: build image
sgratzl Feb 1, 2021
ad82453
feat: config from env variables
sgratzl Feb 1, 2021
189cec6
build: add label link
sgratzl Feb 11, 2021
1ae0c86
Merge pull request #39 from cmu-delphi/sgratzl/build
sgratzl Mar 4, 2021
b7abda5
Update JS client URL
korlaxxalrok Jul 12, 2023
a2dffbf
Use local JS client
korlaxxalrok Jul 12, 2023
16d9e79
Switch from briancla to delphi+crowdcast email address
korlaxxalrok Jul 12, 2023
adfc57c
Test for header mod
korlaxxalrok Jul 12, 2023
8ee2aef
Fix tag closure
korlaxxalrok Jul 12, 2023
59781c2
Remove bracket
korlaxxalrok Jul 12, 2023
6497089
Try some 'this is archived' verbiage
korlaxxalrok Jul 12, 2023
1af609d
Revise text
korlaxxalrok Jul 13, 2023
163b3f4
Add CSS block to make some smallish red text
korlaxxalrok Jul 13, 2023
eef741e
Use new effect in span
korlaxxalrok Jul 13, 2023
ee0a3d0
Slight text update
korlaxxalrok Jul 13, 2023
2370eb6
Update CI to run on dev and main
korlaxxalrok Jul 13, 2023
6738978
TEST: Build on update-and-archive-epicast branch
korlaxxalrok Jul 13, 2023
a02e463
Fix CI
korlaxxalrok Jul 13, 2023
34feb24
Fix indentation
korlaxxalrok Jul 13, 2023
ec7238d
Use correct ref path
korlaxxalrok Jul 13, 2023
b48299e
Move Dockerfile to project root, remove devops dir
korlaxxalrok Jul 13, 2023
889d25d
Ok move it back
korlaxxalrok Jul 13, 2023
7dcc14e
Use Dockerfile at devops path in CI
korlaxxalrok Jul 13, 2023
5751a09
Really fix Dockerfile path in CI
korlaxxalrok Jul 13, 2023
5b8b377
Update style, add text to index page
korlaxxalrok Jul 14, 2023
0849d73
Reduce size
korlaxxalrok Jul 14, 2023
d49c121
Change size
korlaxxalrok Jul 14, 2023
b3af612
New effects, make text sizes different
korlaxxalrok Jul 14, 2023
da3c34d
Fix type, really add effects
korlaxxalrok Jul 14, 2023
1748a8b
Make the archive warning a bit more dramatic
korlaxxalrok Jul 14, 2023
e5acf66
Update readme
korlaxxalrok Jul 19, 2023
74d8819
Remove branch from CI
korlaxxalrok Jul 20, 2023
32599cc
Slight verbiage change
korlaxxalrok Jul 20, 2023
aaf754d
Update support email address
korlaxxalrok Jul 20, 2023
b0f91b5
Merge pull request #43 from cmu-delphi/update-and-archive-epicast
korlaxxalrok Jul 20, 2023
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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI
on:
pull_request:
push:
jobs:
build-tag-push-deploy:
runs-on: ubuntu-latest
if: >
github.ref == 'refs/heads/main' ||
github.ref == 'refs/heads/dev'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: cmu-delphi-deploy-machine
password: ${{ secrets.CMU_DELPHI_DEPLOY_MACHINE_PAT }}
- name: Build, tag, and push image to GitHub Container Registry
id: image
run: |
baseRef="${GITHUB_REF#*/}"
baseRef="${baseRef#*/}"
case "${baseRef}" in
main)
image_tag="latest"
;;
*)
image_tag="${baseRef//\//_}" # replace `/` with `_` in branch name
;;
esac
cd ${{ github.workspace }}
echo "using tag: --${image-tag}--"
docker build -t ghcr.io/${{ github.repository }}:${image_tag} --file ./devops/Dockerfile .
docker push ghcr.io/${{ github.repository }}:${image_tag}
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_OUTPUT
- name: Trigger smee.io webhook to deploy new container image
run: |
curl -H "Authorization: Bearer ${{ secrets.DELPHI_DEPLOY_WEBHOOK_TOKEN }}" \
-X POST ${{ secrets.DELPHI_DEPLOY_WEBHOOK_URL }} \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "repository=ghcr.io/${{ github.repository }}&tag=${{ steps.image.outputs.IMAGE_TAG }}"
41 changes: 34 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,39 @@
# Status

[![Deploy Status](https://delphi.midas.cs.cmu.edu/~automation/public/github_deploy_repo/badge.php?repo=cmu-delphi/www-crowdcast)](#)

# About

The Crowdcast website for collecting flu forecasts.
The Crowdcast website for collecting flu forecasts. (Previously known as
Epicast.)

The site is live at <https://delphi.cmu.edu/crowdcast>.

# Branches

The website is deployed to two separate environments: `staging` and `production`. The code for those environments is kept in the
[`dev`](https://github.com/cmu-delphi/www-epicast/tree/dev) and
[`main`](https://github.com/cmu-delphi/www-epicast/tree/main) branches,
respectively.

## `dev` branch

The `dev` branch is deployed to a Delphi-internal development environment where we can iterate quickly without worry of breaking the production site.

## `main` branch

The `main` branch is deployed to a public-facing production environment. It
should contain only tested and reliable code.

## Process

**`main` should not be updated while a forecasting round is active** (i.e.
Friday through Monday), except in case of a critical bugfix.

Basic develop changes -> deploy/review in staging -> release to production workflow:

- Start by creating a **[bug|fix|feature|etc]** branch based on `dev`.
- Make a PR and tag a reviewer with your changes against `dev`. Once apporved and merged this will trigger CI to deploy the application at https://staging.delphi.cmu.edu/crowdcast.
- Once staging is reviewed and deemed acceptable, make a PR against `main` and tag a reviewer. Once this is approved and merged the production version of the application will be available at https://delphi.cmu.edu/crowdcast

The site is live at:
- https://delphi.cmu.edu/crowdcast
# Development

A live demo is available at http://demo.epicast.net/ (User ID is `00000000`)
For developing the website, see the
[epicast development guide](docs/epicast_development.md).
25 changes: 9 additions & 16 deletions deploy.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,35 @@
{
"type": "move",
"src": "site/.htaccess",
"dst": "/var/www/html/crowdcast/.htaccess",
"dst": "/var/www/html/cc-test/.htaccess",
"add-header-comment": false
},
"// service worker",
{
"type": "move",
"src": "site/sw.js",
"dst": "/var/www/html/crowdcast/sw.js",
"add-header-comment": true
},
"// web sources",
{
"type": "move",
"src": "site/",
"dst": "/var/www/html/crowdcast/",
"dst": "/var/www/html/cc-test/",
"match": "^.*\\.php$",
"add-header-comment": true
},
{
"type": "move",
"src": "site/common/",
"dst": "/var/www/html/crowdcast/common/",
"dst": "/var/www/html/cc-test/common/",
"match": "^.*\\.php$",
"add-header-comment": true
},
{
"type": "move",
"src": "site/css/",
"dst": "/var/www/html/crowdcast/css/",
"match": "^.*\\.(css|php)$",
"dst": "/var/www/html/cc-test/css/",
"match": "^.*\\.(php)$",
"add-header-comment": true
},
{
"type": "move",
"src": "site/js/",
"dst": "/var/www/html/crowdcast/js/",
"dst": "/var/www/html/cc-test/js/",
"match": "^.*\\.js$",
"add-header-comment": true
},
Expand All @@ -51,21 +44,21 @@
{
"type": "move",
"src": "site/images/flags/",
"dst": "/var/www/html/crowdcast/images/flags/",
"dst": "/var/www/html/cc-test/images/flags/",
"match": "^.*\\.png$"
},
"// tutorials",
{
"type": "move",
"src": "site/images/",
"dst": "/var/www/html/crowdcast/images/",
"dst": "/var/www/html/cc-test/images/",
"match": "^.*\\.(gif|mp4)$"
},
"// benchmark data",
{
"type":"move",
"src":"site/data/",
"dst":"/var/www/html/crowdcast/data/",
"dst":"/var/www/html/cc-test/data/",
"match":"^.*\\.csv$"
}
]
Expand Down
19 changes: 19 additions & 0 deletions dev/docker/database/epicast/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# start with the `delphi_database` image
FROM delphi_database

# create the `epicast2` database
ENV MYSQL_DATABASE epicast2

# create the `epi` user account with a development-only password
ENV MYSQL_USER user
ENV MYSQL_PASSWORD pass

# provide DDL which will create empty tables at container startup
# note that files are executed in order of filename alphabetically, so here
# destination files are named such that table definitions are executed prior to
# data insertions
COPY repos/delphi/www-epicast/src/ddl/epicast2.sql /docker-entrypoint-initdb.d/0_epicast2.sql
COPY repos/delphi/www-epicast/src/ddl/development_data.sql /docker-entrypoint-initdb.d/1_development_data.sql

# ensure files are readable at runtime
RUN chmod o+r /docker-entrypoint-initdb.d/*
27 changes: 27 additions & 0 deletions dev/docker/database/epicast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# `delphi_database_epicast`

This image extends Delphi's database by:

- adding the `epi` user account
- adding the `epicast2` database
- creating and minimally populating tables in `epicast2`

To start a container from this image, run:

```bash
docker run --rm -p 13306:3306 \
--network delphi-net --name delphi_database_epicast \
delphi_database_epicast
```

For debugging purposes, you can interactively connect to the database inside
the container using a `mysql` client (either installed locally or supplied via
a docker image) like this:

```bash
mysql --user=user --password=pass --port 13306 --host 127.0.0.1 epicast2
```

Note that using host `localhost` may fail on some platforms as mysql will
attempt, and fail, to use a Unix socket. Using `127.0.0.1`, which implies
TCP/IP, works instead.
30 changes: 30 additions & 0 deletions dev/docker/web/epicast/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# start with the `delphi_web` image
FROM delphi_web

# enable mod_rewrite, aka RewriteEngine
RUN a2enmod rewrite

# enable mod_headers
RUN a2enmod headers

# create an empty htpasswd file
RUN touch /var/www/passwords

# deploy the Epicast website (see `www-epicast/deploy.json`)
# deploy files in an order that tries to take advantage of build caching

COPY repos/delphi/www-epicast/site/images/* /var/www/html/images/
COPY repos/delphi/www-epicast/site/images/flags/* /var/www/html/images/flags/
COPY repos/delphi/www-epicast/site/data/* /var/www/html/data/

COPY repos/delphi/www-epicast/site/css/* /var/www/html/css/
COPY repos/delphi/www-epicast/site/js/*.js /var/www/html/js/
COPY repos/delphi/www-epicast/site/js/us-map /var/www/html/js/us-map
COPY repos/delphi/www-epicast/site/common/* /var/www/html/common/
COPY repos/delphi/www-epicast/site/*.php /var/www/html/

# point to the local development database (overwrites `common/settings.php`)
COPY repos/delphi/www-epicast/dev/docker/web/epicast/assets/settings.php /var/www/html/common/

# ensure files are readable at runtime
RUN chmod o+r -R /var/www/html
24 changes: 24 additions & 0 deletions dev/docker/web/epicast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# `delphi_web_epicast`

This image starts with Delphi's web server and adds the sources necessary for
hosting the Epicast website. It further extends Delphi's web server by:

- enabling the `mod_rewrite` extension
- enabling the `mod_headers` extension
- creating an empty `htpasswd` file

This image includes the file
[`settings.php`](assets/settings.php), which points to a local
container running the
[`delphi_database_epicast` image](../../database/epicast/README.md).

To start a container from this image, run:

```bash
docker run --rm -p 10080:80 \
--network delphi-net --name delphi_web_epicast \
delphi_web_epicast
```

You should be able to login and interact with the website (e.g. submitting
predictions) by visiting `http://localhost:10080/` in a web browser.
15 changes: 15 additions & 0 deletions dev/docker/web/epicast/assets/settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/* Settings and secrets for local development of the Epicast website. */

$dbHost = 'delphi_database_epicast';
$dbPort = 3306;
$dbUser = 'user';
$dbPass = 'pass';
$dbName = 'epicast2';

$epicastAdmin = array(
'name' => 'Delphi Developer',
'email' => 'fake_email_address',
);
?>
28 changes: 28 additions & 0 deletions devops/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# start with a standard php7+apache image
# based on https://github.com/cmu-delphi/operations
FROM php:7-apache
LABEL org.opencontainers.image.source = "https://github.com/cmu-delphi/www-epicast"


# use PHP's recommended configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

# install and enable PHP's `mysqli` extension
RUN docker-php-ext-install mysqli && \
docker-php-ext-enable mysqli

# use delphi's timezome
RUN ln -s -f /usr/share/zoneinfo/America/New_York /etc/localtime && \
sed -i $PHP_INI_DIR/php.ini -e 's/^;date.timezone =$/date.timezone = "America\/New_York"/'
# enable mod_rewrite, aka RewriteEngine
RUN a2enmod rewrite && a2enmod headers

ENV EPICAST_DB_HOST 'localhost'
ENV EPICAST_DB_PORT '3306'
ENV EPICAST_DB_USER 'user'
ENV EPICAST_DB_PASSWORD 'pass'
ENV EPICAST_DB_NAME 'epicast2'

COPY ./site/ /var/www/html/
# ensure files are readable at runtime
RUN chmod o+r -R /var/www/html
9 changes: 9 additions & 0 deletions site/.htaccess
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
RewriteEngine On

## Restrict access to known users or docker development ##
AuthType Basic
AuthName "Restricted Site: Crowdcast"
AuthBasicProvider file
AuthUserFile /var/www/passwords
Require user cctest
Require ip 172.16.0.0/12
## Restrict access to known users or docker development ##

## Compress Files ##
<IfModule mod_deflate.c>
<filesMatch "\.(js|css|html|php|svg|htm|xml|json)$">
Expand Down
46 changes: 46 additions & 0 deletions site/FAQ.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,52 @@
another project (not crowdsourced) we are forecasting future
demand on hospitals.
</p>

</br>

<p>
<font size="5">
5. “Can you only see your score if you’re one of the top 10? / Can you see more than just last weeks forecast? I’m having trouble figuring out if my prior forecasts were any good. "
</font>
</p>
<p>
Answer: Unfortunately we can only show the top 10 scores.  However, your own score each week is always sent you you in the email you receive the following week.
</p>

</br>

<p>
<font size="5">
6. “I only have an iPhone. I do not have a computer to work on. Should I withdraw from the study or is there a way I can use my iPhone? "
</font>
</p>
<p>
Answer: Unfortunately we do not yet have a way to support smooth participation by phone.
</p>

</br>

<p>
<font size="5">
7. “On forecasting methodologies: Would you like us to forecast the following week, two weeks out, or the rest of the dates on the graph? Do you want us to use a method we can communicate to others? Do you want us to use a statistical method or just look at the data in the context of what you know from public information?"
</font>
</p>
<p>
Answer: Please forecast the rest of the time period shown on the Crowdcast display.  You may use any method you wish, including qualitative reasoning and personal judgement, using whatever data you have and anything else that you believe is relevant.  Your goal is to be as accurate as possible, regardless of the method you use.
</p>

</br>

<p>
<font size="5">
8. “On forecasting assumptions: Now that there is a pandemic, people are being asked to self-isolate if they have symptoms, instead of seeing a doctor, because of shortage of testing. Would you have to take that into consideration when making your forecasts? (i.e. it would be lower then you may predict because of lack of doctor’s visits, and lack of testing). Is it based on what I see around my area? People sheltering or using social distancing base not doing those things?"
</font>
</p>
<p>
Answer: You should take into account all considerations that you believe are relevant to what will eventually be measured and reported in the location for which you are forecasting.
</p>


</div>
</div>
<?php
Expand Down
Loading