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

pull from upstream #6

Merged
merged 58 commits into from
May 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
e6acd31
Add the utf-8 byte order marker to simplify issues with loading to Excel
obrien-j Oct 6, 2018
9693d16
Brought tests suites inline with models.py, handle the utf-8 BOM, and…
obrien-j Oct 6, 2018
e41b1da
Whoops. params where they should have been.
obrien-j Oct 6, 2018
2e1905b
Minor changes to cache invalidation to get rid of write access rqmt.
obrien-j Oct 10, 2018
758de1f
ugh tests.
obrien-j Oct 10, 2018
12af9bc
get_cache should be type-hinting a str return, not bool. Also, I was …
obrien-j Oct 13, 2018
1a6a43a
sigh. tests. remember the tests.
obrien-j Oct 13, 2018
b5d2267
- removed Beta banner
sayaHub Oct 24, 2018
29f63c4
Merge branch 'cache-rewrite' into dev
sayaHub Oct 24, 2018
f38223b
Merge branch 'utf-8-fixups' into dev
sayaHub Oct 24, 2018
5c5e836
Merge branch 'hotfix-align-with-canada-req' into dev
sayaHub Oct 24, 2018
b4ec421
- removed temporary Google Analytics
sayaHub Oct 25, 2018
58c2077
Merge branch 'hotfix-csp-implementation' into dev
sayaHub Oct 25, 2018
23ada97
forgot one inline onclick javascript
sayaHub Oct 26, 2018
78820f8
Merge branch 'hotfix-csp-implementation' into dev
sayaHub Oct 26, 2018
68a7a39
- implemented a whitelist for report names that can be call via the a…
sayaHub Oct 31, 2018
08e54ba
- forgot one file
sayaHub Oct 31, 2018
be00f51
Merge branch 'hotfix-reports-name-whitelist' into dev
sayaHub Oct 31, 2018
dfb9c03
build package for public app
dsamojlenko Oct 31, 2018
aee2702
fix syntax errors
dsamojlenko Oct 31, 2018
5114392
fire new job names
dsamojlenko Oct 31, 2018
6a684c7
added logic to only display the donut for Public users
sayaHub Nov 5, 2018
5b69391
Merge remote-tracking branch 'remotes/origin/build_public_package' in…
sayaHub Nov 5, 2018
61f60c9
Merge branch 'hotfix-dual-app' into dev
sayaHub Nov 5, 2018
17c5cd5
forgot to remove bold for links for modal (How to read this table?)
sayaHub Nov 7, 2018
44b2076
removed some unwanted space
sayaHub Nov 9, 2018
ef1e55f
put back Beta Banner
sayaHub Nov 19, 2018
9694aab
Merge branch 'hotfix-align-with-canada-req' into dev
sayaHub Nov 19, 2018
9d841c5
Minor tweaks to config to enable usage of Azure Managed Service Ident…
Nov 20, 2018
0fd0cbb
this time with updated req's
obrien-j Nov 20, 2018
1768344
local ci would be great when you're sleep deprived.
obrien-j Nov 20, 2018
1ea740a
removed secret name out of code
sayaHub Nov 23, 2018
178e595
Merge branch 'azure_msi' into dev
sayaHub Nov 23, 2018
aa2db55
Removed headers due to duplication..
obrien-j Jan 3, 2019
22da9d4
Security Update: pyyaml bump to pull in safe_load
obrien-j Jan 6, 2019
3909b87
Security Update: pyyaml version bump
obrien-j Jan 6, 2019
3b2e38a
Paginate scroll to top
timarney Jan 7, 2019
ad84e85
Merge branch 'to-top' into dev
sayaHub Jan 9, 2019
7fa48b3
Merge branches 'duplicate-headers' and 'pyyaml_security_bump' into dev
sayaHub Jan 9, 2019
d580ced
add semi-colon
timarney Jan 10, 2019
d5aa841
Merge branch 'to-top' into dev
sayaHub Jan 11, 2019
797e496
- Implementation of Google Tag Manager
sayaHub Mar 27, 2019
7ded3e4
fix typo
sayaHub Mar 27, 2019
b9b29c1
fix data-domain, can't use comma to enclose value, break if value hav…
sayaHub Mar 27, 2019
c4f6c18
removed CSP policies from HTML header. CSP is now implemented on Ngin…
sayaHub Apr 2, 2019
f6e1980
- some cleanup before merge to Master branch
sayaHub Apr 2, 2019
c06c7d0
- to fix Alerts from LGTM
sayaHub Apr 2, 2019
19b1be1
Merge pull request #124 from cds-snc/dev
obrien-j Apr 5, 2019
efec629
Compatibility with kubernetes (#127)
maxneuvians Apr 8, 2019
90cbff1
defer datatable render (#129)
timarney Apr 9, 2019
b4821d3
Changed worker type and worker amount (#130)
maxneuvians Apr 9, 2019
7d65ff8
Added PR review app configuration;
maxneuvians Apr 12, 2019
0b8a74d
Actually hit the right container
maxneuvians Apr 12, 2019
0a518a9
Take 2
maxneuvians Apr 12, 2019
7e2c53b
Merge pull request #131 from cds-snc/elenchos
maxneuvians Apr 15, 2019
9ff451a
Upgraded deps (#132)
maxneuvians Apr 18, 2019
ded779c
Task default organizations (#136)
sayaHub May 8, 2019
488d3a7
update content for the Guidance page (#137)
sayaHub May 17, 2019
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
19 changes: 16 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
docker push "${DOCKER_REGISTRY}/${DOCKER_NAMESPACE}/${CIRCLE_PROJECT_REPONAME}:latest"
name: "Build and Deploy Website Docker Image"
working_directory: ~/repo
build_package:
build_internal_package:
docker:
- image: cdssnc/track-web-build:0.1.0
working_directory: /opt/apps/track-web
Expand All @@ -58,12 +58,25 @@ jobs:
- store_artifacts:
path: /opt/apps/track-web/track-web.tar.gz
destination: track-web.tar.gz

build_external_package:
docker:
- image: cdssnc/track-web-build:0.1.0
working_directory: /opt/apps/track-web-public
steps:
- checkout
- run:
command: sh deploy/build-env-public.sh
- store_artifacts:
path: /opt/apps/track-web-public/track-web-public.tar.gz
destination: track-web-public.tar.gz
workflows:
version: 2
tracker:
jobs:
- track_web
- build_package:
- build_internal_package:
requires:
- track_web
- build_external_package:
requires:
- track_web
11 changes: 11 additions & 0 deletions .github/main.workflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
workflow "CI" {
on = "push"
resolves = [
"Dockerfile lint"
]
}

action "Dockerfile lint" {
uses = "docker://cdssnc/docker-lint"
args = "--ignore DL3013"
}
16 changes: 4 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
MAINTAINER David Buckley <[email protected]>
FROM python:3.5 as python-base
LABEL Description="Track Web Security Compliance" Vendor="Canadian Digital Service"

FROM python:3.5 as python-base
COPY requirements.txt /opt/track-web/requirements.txt
COPY setup.py /opt/track-web/setup.py
COPY track /opt/track-web/track
COPY MANIFEST.in /opt/track-web/MANIFEST.in

# Build wheels to install into production image
# Force a build with --no-binary to get around the case where a wheel is available for python:3.5 but not python:3.5-alpine
RUN pip install --upgrade pip && mkdir wheels && pip wheel --no-binary :all: -r /opt/track-web/requirements.txt -w wheels && pip wheel --no-deps /opt/track-web/ -w wheels

FROM python:3.5-alpine
MAINTAINER David Buckley <[email protected]>
LABEL Description="Track Digital Security Compliance" Vendor="Canadian Digital Service"

COPY --from=python-base /wheels /wheels

RUN pip install /wheels/* && rm -rf /wheels /root/.cache/pip && \
addgroup -S track-web && adduser -S -G track-web track-web && \
addgroup --system track-web && adduser --system --group track-web && \
mkdir -p /opt/track-web/.cache && \
chown -R track-web /opt/track-web

USER track-web:track-web

EXPOSE 5000
ENTRYPOINT ["gunicorn", "track.wsgi:app", "--bind=0.0.0.0:5000", "--worker-class=gthread", "--access-logfile=-", "--error-logfile=-", "--capture-output"]
ENTRYPOINT ["gunicorn", "track.wsgi:app", "--bind=0.0.0.0:5000", "--worker-class=sync", "--access-logfile=-", "--error-logfile=-", "--log-level=debug", "--workers=4"]
7 changes: 0 additions & 7 deletions Dockerfile.build

This file was deleted.

9 changes: 9 additions & 0 deletions deploy/build-env-public.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
WORKDIR=${1:-"/opt/apps/track-web-public"}
mkdir -p $WORKDIR
cd $WORKDIR
python3 -m venv .venv
. .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
tar -czvf track-web-public.tar.gz .venv track
rm -rf .venv
8 changes: 0 additions & 8 deletions docker-compose.yml

This file was deleted.

6 changes: 6 additions & 0 deletions elenchos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dockerfiles": {
"grc.io/cdssnc/track-web": "."
},
"overlay": "manifests/overlays/elenchos"
}
28 changes: 28 additions & 0 deletions manifests/overlays/elenchos/app-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: track-web
name: track-web
spec:
selector:
matchLabels:
app: track-web
template:
metadata:
labels:
app: track-web
spec:
containers:
- image: gcr.io/cdssnc/track-web
imagePullPolicy: Always
name: track-web
env:
- name: TRACKER_MONGO_URI
value: mongodb://track-ro:0D^GEPgF52d&[email protected]:13692/trackweb
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
status: {}
14 changes: 14 additions & 0 deletions manifests/overlays/elenchos/app-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
labels:
name: track-web
name: track-web
spec:
type: NodePort
ports:
- port: 5000
targetPort: 5000
selector:
app: track-web

10 changes: 10 additions & 0 deletions manifests/overlays/elenchos/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
- app-deployment.yaml
- app-service.yaml
- traefik-ingress-controller-cluster-role-binding.yaml
- traefik-ingress-controller-cluster-role.yaml
- traefik-ingress-controller-deployment.yaml
- traefik-ingress-controller-service-account.yaml
- traefik-ingress.yaml
- traefik-ingress-service.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: traefik-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-ingress-controller
namespace: kube-system
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: traefik-ingress-controller
namespace: kube-system
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- secrets
verbs:
- get
- list
- watch
- apiGroups:
- extensions
resources:
- ingresses
verbs:
- get
- list
- watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-controller
namespace: kube-system
spec:
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
spec:
containers:
- args:
- --api
- --kubernetes
- --debug
- --defaultentrypoints=http
- --entrypoints=Name:http Address::80
image: traefik:1.7
name: traefik-ingress-lb
ports:
- containerPort: 80
hostPort: 80
name: http
- containerPort: 8080
hostPort: 8080
name: admin
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
13 changes: 13 additions & 0 deletions manifests/overlays/elenchos/traefik-ingress-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: traefik-ingress-service
namespace: kube-system
spec:
ports:
- name: http
port: 80
protocol: TCP
selector:
k8s-app: traefik-ingress-lb
type: LoadBalancer
14 changes: 14 additions & 0 deletions manifests/overlays/elenchos/traefik-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: traefik
name: traefik-ingress
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: track-web
servicePort: 5000
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ flask==0.12.4
gunicorn==19.6.0
pyyaml==3.13
python-slugify==1.2.1
Flask-PyMongo==0.5.1
Flask-PyMongo==2.2.0
flask-compress==1.4.0
click==6.7
Babel==2.6.0
Flask-Caching==1.4.0
pymongo==3.7.0
pymongo==3.7.2
azure-keyvault==1.1.0
msrestazure==0.5.1
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
'gunicorn==19.6.0',
'pyyaml==3.13',
'python-slugify==1.2.1',
'pymongo==3.7.0',
'Flask-PyMongo==0.5.1',
'pymongo==3.7.2',
'Flask-PyMongo==2.2.0',
'flask-compress==1.4.0',
'click==6.7',
'Babel==2.6.0',
Expand Down
4 changes: 3 additions & 1 deletion track/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@
class Config:
DEBUG = False
TESTING = False
MONGO_URI = "mongodb://localhost:27017/track"
MONGO_URI = os.environ.get("TRACKER_MONGO_URI", "mongodb://localhost:27017/track")
CACHE_TYPE = "null"

@staticmethod
def init_app(app):
pass



class ProductionConfig(Config):

CACHE_TYPE = "filesystem"
Expand Down
5 changes: 5 additions & 0 deletions track/helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pkg_resources
import yaml
import datetime
import os
from track import models
from track.data import FIELD_MAPPING
from babel.dates import format_date
Expand Down Expand Up @@ -56,3 +57,7 @@ def percent(num, denom):
@app.template_filter("percent_not")
def percent_not(num, denom):
return (100 - round((num / denom) * 100))

@app.template_filter("fetch_env")
def fetch_env(value):
return os.getenv(value)
7 changes: 7 additions & 0 deletions track/static/css/main.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion track/static/css/main.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions track/static/js/dataTables.downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ $.fn.dataTable.Download = function ( inst ) {
if (drawnOnce) return;

var elem = "" +
"<a onClick=\"gtag('event', 'download', { event_category: 'Download / Télécharger', event_action: 'Download / Télécharger CSV'});\" class=\"text-https-blue hover:text-black font-bold\" href=\"" + csv + "\" download>" +
text +
"</a>";
"<a class=\"text-https-blue hover:text-black font-bold\" href=\"" + csv + "\" download>" + text +"</a>";

container.html(elem);
drawnOnce = true;
Expand Down
Loading