From 6865f665b69813a3431a04feec2ed8dc3f00935a Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sun, 27 Oct 2019 12:53:08 +0100 Subject: [PATCH 1/8] add autoprefixer to css pipeline --- .dockerignore | 1 + Dockerfile.python | 5 ++++- build/Dockerfile | 2 +- docker-compose.yml | 8 -------- homepage/postcss.config.js | 5 +++++ homepage/requirements.txt | 2 +- homepage/theme/static/css/style.scss | 17 ----------------- homepage/theme/templates/base.html | 2 +- 8 files changed, 13 insertions(+), 29 deletions(-) create mode 100644 .dockerignore create mode 100644 homepage/postcss.config.js diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6956925 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +homepage/output diff --git a/Dockerfile.python b/Dockerfile.python index 2397f9b..d2955c4 100644 --- a/Dockerfile.python +++ b/Dockerfile.python @@ -1,3 +1,6 @@ -FROM python:3.7 +FROM nikolaik/python-nodejs:python3.7-nodejs12 + +RUN npm install -g postcss-cli@^6.1.3 autoprefixer@^9.7.0 ENV PATH="/root/.local/bin:$PATH" +ENV NODE_PATH="/usr/lib/node_modules" diff --git a/build/Dockerfile b/build/Dockerfile index e8dcf39..3329386 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -5,7 +5,7 @@ ENV SITEURL=$siteurl COPY ./homepage /code/homepage -RUN npm install svgo -g +RUN npm install -g postcss-cli@^6.1.3 autoprefixer@^9.7.0 svgo@^1.3.0 RUN apt-get update \ && apt-get install -y libjpeg-progs optipng \ && rm -rf /var/lib/apt/lists/* diff --git a/docker-compose.yml b/docker-compose.yml index 269b060..d50f335 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,20 +19,12 @@ services: - database:/data environment: OFFEN_APP_EVENTRETENTIONPERIOD: 4464h - OFFEN_APP_DEVELOPMENT: '1' OFFEN_APP_DISABLESECURECOOKIE: '1' OFFEN_DATABASE_CONNECTIONSTRING: /data/offen.db OFFEN_SERVER_PORT: 8080 OFFEN_SERVER_REVERSEPROXY: '1' OFFEN_SECRETS_COOKIEEXCHANGE: 8jeKYbbnywoYIZznu4HffQ== OFFEN_SECRETS_EMAILSALT: eypctS7SVKM1Ureb61db5Q== - depends_on: - - server_database - - server_database: - image: postgres:11.2 - environment: - POSTGRES_PASSWORD: develop homepage: build: diff --git a/homepage/postcss.config.js b/homepage/postcss.config.js new file mode 100644 index 0000000..88752c6 --- /dev/null +++ b/homepage/postcss.config.js @@ -0,0 +1,5 @@ +module.exports = { + plugins: [ + require('autoprefixer') + ] +} diff --git a/homepage/requirements.txt b/homepage/requirements.txt index 575200b..401a5fb 100644 --- a/homepage/requirements.txt +++ b/homepage/requirements.txt @@ -1,5 +1,5 @@ pelican==4.0.1 markdown==3.1.1 -webassets==0.12.1 +git+git://github.com/miracle2k/webassets#d1f3455e383446ca4ab0c644f326ee937e68e809 cssmin==0.2.0 libsass==0.19.3 diff --git a/homepage/theme/static/css/style.scss b/homepage/theme/static/css/style.scss index 8ec4c68..de13090 100644 --- a/homepage/theme/static/css/style.scss +++ b/homepage/theme/static/css/style.scss @@ -132,9 +132,6 @@ CARDS display: flex; } .card { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; flex-direction: column; width: 280px; color: $black-mid; @@ -154,14 +151,9 @@ CARDS @media only screen and (max-width: 960px) { .card-deck, .footer-card-deck { - -webkit-box-orient: vertical; - -webkit-box-direction: normal; - -ms-flex-direction: column; flex-direction: column; } .card-deck { - -webkit-box-pack: center; - -ms-flex-pack: center; justify-content: center; } .card { @@ -178,22 +170,15 @@ CARDS @media only screen and (min-width: 961px) { .card-deck, .footer-card-deck { - -webkit-box-orient: horizontal; - -webkit-box-direction: normal; - -ms-flex-direction: row; flex-direction: row; } .card-deck { - -webkit-box-pack: center; - -ms-flex-pack: center; justify-content: center; } .card:nth-child(2) { margin: 0 50px 0 50px; } .footer-card-deck { - -webkit-box-pack: justify; - -ms-flex-pack: justify; justify-content: space-between; } .footer-card:nth-child(1), @@ -379,8 +364,6 @@ BUTTONS margin: 40px 0 0 0; } .btn { - -webkit-border-radius: 0; - -moz-border-radius: 0; border-radius: 0px; padding: 8px 30px; text-align: center; diff --git a/homepage/theme/templates/base.html b/homepage/theme/templates/base.html index 1bafbee..3825d7f 100644 --- a/homepage/theme/templates/base.html +++ b/homepage/theme/templates/base.html @@ -19,7 +19,7 @@ - {% assets filters="libsass,cssmin", output="css/style.min.css", "css/normalize.css", "css/fonts.css", "css/style.scss" %} + {% assets filters="libsass,postcss,cssmin", output="css/style.min.css", "css/normalize.css", "css/fonts.css", "css/style.scss" %} {% endassets %} {% if OFFEN_ACCOUNT_ID and not page.no_stats %} From d2495563274a568fcf954b0c289485c4c348ff72 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sun, 27 Oct 2019 13:05:44 +0100 Subject: [PATCH 2/8] fix canonical and og urls --- homepage/theme/templates/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homepage/theme/templates/base.html b/homepage/theme/templates/base.html index 1bafbee..2349e22 100644 --- a/homepage/theme/templates/base.html +++ b/homepage/theme/templates/base.html @@ -13,11 +13,11 @@ - + - + {% assets filters="libsass,cssmin", output="css/style.min.css", "css/normalize.css", "css/fonts.css", "css/style.scss" %} From 033c03d9e5a8ba7418770382b41d74a5f7e2a2a6 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sun, 27 Oct 2019 21:14:52 +0100 Subject: [PATCH 3/8] add missing NODE_PATH --- build/Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/Dockerfile b/build/Dockerfile index 3329386..7b4858c 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -11,7 +11,8 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* WORKDIR /code/homepage -ENV PATH /root/.local/bin:$PATH +ENV PATH "/root/.local/bin:$PATH" +ENV NODE_PATH="/usr/lib/node_modules" RUN pip install --user -r requirements.txt RUN make publish From 86fe6fec1a433d6b094b93dd7b661172d863782d Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Mon, 28 Oct 2019 15:54:04 +0100 Subject: [PATCH 4/8] update development image to include shutdown fix --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d50f335..69c1620 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: - server server: - image: offen/offen@sha256:4c0d2d5db9bc749d21ad8659008658bf25318074b7c813b0a694e64816df750d + image: offen/offen@sha256:91845f3e0e80f7d1871f58dabd08e8614ec70f6ff37ef7e9b675d0f4f1c9ca13 command: serve volumes: - ./bootstrap.yml:/bootstrap.yml From 620c1c1b73d9525c5708d92209301ae8a121085b Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Tue, 29 Oct 2019 12:47:34 +0100 Subject: [PATCH 5/8] limit server names when deployed --- build/nginx.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/build/nginx.conf b/build/nginx.conf index 10b7d0e..f1c51a3 100644 --- a/build/nginx.conf +++ b/build/nginx.conf @@ -28,6 +28,7 @@ http { autoindex on; root /www/data; expires $expires; + servername www.offen.dev staging.offen.dev; add_header Content-Security-Policy $csp; add_header Strict-Transport-Security 'max-age=604800; includeSubDomains'; add_header Referrer-Policy 'origin-when-cross-origin'; From 46effb2387ade90880a1fc28ecf5922ed295f9cf Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Tue, 29 Oct 2019 12:53:43 +0100 Subject: [PATCH 6/8] fix typo in server config --- build/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/nginx.conf b/build/nginx.conf index f1c51a3..e1853c1 100644 --- a/build/nginx.conf +++ b/build/nginx.conf @@ -28,7 +28,7 @@ http { autoindex on; root /www/data; expires $expires; - servername www.offen.dev staging.offen.dev; + server_name www.offen.dev staging.offen.dev; add_header Content-Security-Policy $csp; add_header Strict-Transport-Security 'max-age=604800; includeSubDomains'; add_header Referrer-Policy 'origin-when-cross-origin'; From 11f20ea0848cee6ace88d67ad07c71afc3f54e52 Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sun, 3 Nov 2019 22:53:32 +0100 Subject: [PATCH 7/8] remove logspout container from production setup --- Dockerrun.aws.json.production | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Dockerrun.aws.json.production b/Dockerrun.aws.json.production index 80bdc44..21a69e2 100644 --- a/Dockerrun.aws.json.production +++ b/Dockerrun.aws.json.production @@ -37,19 +37,6 @@ "environment": [ { "name": "OFFEN_SERVER_REVERSEPROXY", "value": "1" } ] - }, - { - "name": "logspout", - "image": "gliderlabs/logspout:latest", - "essential": true, - "memory": 64, - "command": ["syslog+tls://$LOG_TARGET"], - "mountPoints": [ - { - "sourceVolume": "log-socket", - "containerPath": "/var/run/docker.sock" - } - ] } ] } From 4247d190c41e205783ed11ce4f3561de2cabef8d Mon Sep 17 00:00:00 2001 From: Frederik Ring Date: Sun, 3 Nov 2019 22:59:32 +0100 Subject: [PATCH 8/8] lock docker image used for migrations --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8b28e52..b6b534e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -93,7 +93,7 @@ jobs: fi - run: name: Run database migrations - command: docker run -it offen/offen:$DOCKER_IMAGE_TAG migrate -conn $(aws secretsmanager get-secret-value --secret-id $TARGET_ENVIRONMENT/postgresConnectionString | jq -r '.SecretString') + command: docker run -it offen/offen:offen@sha256:4c0d2d5db9bc749d21ad8659008658bf25318074b7c813b0a694e64816df750d migrate -conn $(aws secretsmanager get-secret-value --secret-id $TARGET_ENVIRONMENT/postgresConnectionString | jq -r '.SecretString') - run: name: Deploy command: |