Skip to content

Commit

Permalink
Ok web-app deploys again (with SSL)
Browse files Browse the repository at this point in the history
  • Loading branch information
holdenk committed Aug 31, 2023
1 parent 895d04d commit 70a1756
Show file tree
Hide file tree
Showing 20 changed files with 127 additions and 349 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM python:3.9-buster as base-amd64
FROM base-${TARGETARCH}

# install nginx
RUN apt-get update && apt-get install nginx vim emacs libmariadbclient-dev default-libmysqlclient-dev libssl-dev nodejs npm -y
RUN apt-get update && apt-get install nginx vim emacs libmariadbclient-dev default-libmysqlclient-dev libssl-dev nodejs npm python3-opencv libgl1 -y
COPY /conf/nginx.default /etc/nginx/sites-available/default
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
&& ln -sf /dev/stderr /var/log/nginx/error.log
Expand All @@ -21,7 +21,7 @@ COPY requirements.txt /opt/app/
RUN pip install --upgrade pip && pip install -r /opt/app/requirements.txt
RUN mkdir -p /opt/app/pip_cache
COPY static /opt/app/static
ADD fighthealthinsurance /opt/app/
ADD fighthealthinsurance /opt/app/fighthealthinsurance
COPY scripts/start-server.sh /opt/app/
COPY *.py /opt/app/
WORKDIR /opt/app/
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ mypy -p fighthealthinsurance
pushd ./static/js; npm i; npm run build; popd
# Hack, for now.
#docker buildx build --platform=linux/amd64,linux/arm64 -t holdenk/fight-health-insurance:0.0.1 . --push
docker buildx build --platform=linux/amd64,linux/arm64 -t holdenk/fight-health-insurance:v0.0.5 . --push
IMAGE=holdenk/fight-health-insurance:v0.0.8b
docker pull "${IMAGE}" || docker buildx build --platform=linux/amd64,linux/arm64 -t "${IMAGE}" . --push
kubectl apply -f deploy.yaml
4 changes: 2 additions & 2 deletions conf/nginx.default
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
server {
listen 80;
server_name www.pigscanfly.ca;
listen 80 default_server;
server_name _;

location / {
proxy_pass http://127.0.0.1:8010;
Expand Down
23 changes: 12 additions & 11 deletions deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ spec:
replicas: 1
selector:
matchLabels:
app: web-primary
special: web-primary-pod
strategy:
type: Recreate
template:
metadata:
labels:
app: web-primary
group: fight-health-insurance-webbackend
special: web-primary-pod
spec:
containers:
- image: holdenk/fight-health-insurance:v0.0.5
- image: holdenk/fight-health-insurance:v0.0.8b
name: totallylegitco
env:
- name: PRIMARY
Expand Down Expand Up @@ -54,21 +57,19 @@ metadata:
labels:
app: fight-health-insurance
spec:
replicas: 3
replicas: 2
selector:
matchLabels:
app: fight-health-insurance
template:
metadata:
labels:
app: fight-health-insurance
group: fight-health-insurance-webbackend
spec:
containers:
- image: holdenk/fight-health-insurance:v0.0.5
- image: holdenk/fight-health-insurance:v0.0.8b
name: totallylegitco
env:
- name: OAUTHLIB_RELAX_TOKEN_SCOPE
value: "1"
envFrom:
- secretRef:
name: fight-health-insurance-secret
Expand Down Expand Up @@ -98,7 +99,7 @@ apiVersion: v1
kind: Service
metadata:
labels:
app: fight-health-insurance
group: fight-health-insurance
name: web-svc
namespace: totallylegitco
spec:
Expand All @@ -108,7 +109,7 @@ spec:
protocol: TCP
targetPort: web
selector:
app: fight-health-insurance
group: fight-health-insurance-webbackend
sessionAffinity: None
type: ClusterIP
---
Expand All @@ -128,7 +129,7 @@ spec:
- www.fighthealthinsurance.com
- www.fuckhealthinsurance.com
- www.appealhealthinsurance.com
secretName: pcf-tls-secret
secretName: combined-tls-secret
rules:
- host: www.fuckhealthinsurance.com
http:
Expand Down
3 changes: 1 addition & 2 deletions fetch_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
# And redistributing these (publicly available) copies could be tricky
# since we don't have a license for them, but I think we can download them
# on each node. Downside: they might go away and then shit will break.
cd data
mkdir fetched
mkdir -p data
wget https://gist.githubusercontent.com/lieldulev/439793dc3c5a6613b661c33d71fdd185/raw/25c3abcc5c24e640a0a5da1ee04198a824bf58fa/cpt4.csv
wget https://www.cdc.gov/nhsn/xls/cpt-pcm-nhsn.xlsx
109 changes: 71 additions & 38 deletions fighthealthinsurance/migrations/0001_initial.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Generated by Django 4.1.6 on 2023-02-20 00:02
# Generated by Django 4.2.3 on 2023-08-30 22:20

import django.db.models.deletion
from django.db import migrations, models

import django.db.models.deletion
import regex_field.fields


class Migration(migrations.Migration):

initial = True

dependencies = []
Expand All @@ -25,9 +23,16 @@ class Migration(migrations.Migration):
fields=[
("denial_id", models.AutoField(primary_key=True, serialize=False)),
("hashed_email", models.CharField(max_length=300)),
("denial_text", models.CharField(max_length=30000000)),
("submissions", models.DateField()),
("denial_text", models.TextField(max_length=30000000)),
("date", models.DateField(auto_now_add=True)),
("urgent", models.BooleanField(default=False)),
("pre_service", models.BooleanField(default=False)),
("denial_date", models.DateField(null=True)),
("insurance_company", models.CharField(max_length=300, null=True)),
("claim_id", models.CharField(max_length=300, null=True)),
("procedure", models.CharField(max_length=300, null=True)),
("diagnosis", models.CharField(max_length=300, null=True)),
("appeal_text", models.TextField(max_length=3000000000, null=True)),
],
),
migrations.CreateModel(
Expand All @@ -37,6 +42,8 @@ class Migration(migrations.Migration):
("name", models.CharField(max_length=300)),
("regex", regex_field.fields.RegexField(max_length=400)),
("negative_regex", regex_field.fields.RegexField(max_length=400)),
("appeal_text", models.TextField(blank=True, max_length=3000)),
("form", models.CharField(max_length=300, null=True)),
(
"parent",
models.ForeignKey(
Expand All @@ -49,12 +56,21 @@ class Migration(migrations.Migration):
),
],
),
migrations.CreateModel(
name="Diagnosis",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("name", models.CharField(max_length=300)),
("regex", regex_field.fields.RegexField(max_length=400)),
],
),
migrations.CreateModel(
name="FollowUpType",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("name", models.CharField(default="", max_length=300)),
("subject", models.CharField(max_length=300)),
("text", models.CharField(max_length=30000)),
("text", models.TextField(max_length=30000)),
("duration", models.DurationField()),
],
),
Expand All @@ -69,41 +85,26 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
name="Regulator",
name="Procedures",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("name", models.CharField(max_length=300)),
("website", models.CharField(max_length=300)),
("alt_name", models.CharField(max_length=300)),
("regex", regex_field.fields.RegexField(max_length=400)),
("negative_regex", regex_field.fields.RegexField(max_length=400)),
],
),
migrations.CreateModel(
name="FollowUpSched",
name="Regulator",
fields=[
("follow_up_id", models.AutoField(primary_key=True, serialize=False)),
("email", models.CharField(max_length=300)),
("follow_up_date", models.DateField()),
("initial", models.DateField(auto_now_add=True)),
(
"denial_id",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.denial",
),
),
(
"follow_up_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.followuptype",
),
),
("id", models.AutoField(primary_key=True, serialize=False)),
("name", models.CharField(max_length=300)),
("website", models.CharField(max_length=300)),
("alt_name", models.CharField(max_length=300)),
("regex", regex_field.fields.RegexField(max_length=400)),
("negative_regex", regex_field.fields.RegexField(max_length=400)),
],
),
migrations.CreateModel(
name="DenialTypesRelation",
name="PlanTypesRelation",
fields=[
(
"id",
Expand All @@ -122,10 +123,10 @@ class Migration(migrations.Migration):
),
),
(
"denial_type",
"plan_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.denialtypes",
to="fighthealthinsurance.plantype",
),
),
(
Expand All @@ -139,7 +140,30 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
name="DenialRegulatorRelation",
name="FollowUpSched",
fields=[
("follow_up_id", models.AutoField(primary_key=True, serialize=False)),
("email", models.CharField(max_length=300)),
("follow_up_date", models.DateField()),
("initial", models.DateField(auto_now_add=True)),
(
"denial_id",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.denial",
),
),
(
"follow_up_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.followuptype",
),
),
],
),
migrations.CreateModel(
name="DenialTypesRelation",
fields=[
(
"id",
Expand All @@ -158,10 +182,10 @@ class Migration(migrations.Migration):
),
),
(
"regulator",
"denial_type",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="fighthealthinsurance.regulator",
to="fighthealthinsurance.denialtypes",
),
),
(
Expand All @@ -184,9 +208,18 @@ class Migration(migrations.Migration):
),
migrations.AddField(
model_name="denial",
name="regulator",
name="plan_type",
field=models.ManyToManyField(
through="fighthealthinsurance.DenialRegulatorRelation",
through="fighthealthinsurance.PlanTypesRelation",
to="fighthealthinsurance.plantype",
),
),
migrations.AddField(
model_name="denial",
name="regulator",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="fighthealthinsurance.regulator",
),
),
Expand Down
17 changes: 0 additions & 17 deletions fighthealthinsurance/migrations/0002_remove_denial_submissions.py

This file was deleted.

This file was deleted.

Loading

0 comments on commit 70a1756

Please sign in to comment.