Skip to content

Commit db3be51

Browse files
committed
Merge main & update to bikkelhart/internet-nl@87f11734
git fetch bikkelhart git fetch internetnl git merge -X theirs internetnl/main git checkout --no-overlay bikkelhart/bikkelhart-redesign -- frontend interface/templates interface/static translations git checkout --no-overlay main -- interface/static/question@internet.nl_0x45028563.asc convert -resize 48x48 interface/static/favicon.{png,ico} git add interface/static/favicon.ico git rm package{,-lock}.json # manual merge of docker/Dockerfile, docker/compose.development.yaml, fix .gitignore, note: changed *.js copy and base template git commit --amend -m "Merge main & update to bikkelhart/internet-nl@$(git rev-parse bikkelhart/bikkelhart-redesign | cut -c1-8)"
2 parents fe11a50 + 1fa9fb7 commit db3be51

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+4085
-2561
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ config-compose-*
8383

8484
# Frontend
8585
frontend/node_modules
86-
frontend/build
86+
frontend/dist

bin/frontend.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

checks/tasks/update.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def _populate_HOF(hof, model, entry_creation):
7676
previousscore = 0
7777
previoustimestamp = None
7878
previousreportid = None
79-
for report in model.objects.all().order_by("domain", "timestamp"):
79+
for report in model.objects.only("id", "domain", "timestamp", "score").order_by("domain", "timestamp").iterator():
8080
if previousname != report.domain and previousname is not None:
8181
if previousscore >= 100:
8282
entry_creation(hof, previousname, previousreportid, previoustimestamp)

docker/Dockerfile

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,17 @@ USER unbound
134134

135135
ENTRYPOINT ["/entrypoint.sh"]
136136

137-
FROM debian:bullseye-20241111-slim AS frontend
137+
# build frontend image target
138+
FROM --platform=linux/amd64 debian:bullseye-20241111-slim AS frontend
138139

139140
# install npm from official image
140-
COPY --from=node:20-slim /usr/local/bin/ /usr/local/bin/
141-
COPY --from=node:20-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
141+
COPY --from=node:22-slim /usr/local/bin/ /usr/local/bin/
142+
COPY --from=node:22-slim /usr/local/lib/node_modules /usr/local/lib/node_modules
142143

143144
ADD frontend/ /app/frontend
144145
WORKDIR /app/frontend
145146
RUN npm install
146-
RUN npm run css:build
147+
RUN npm run docker:build
147148

148149
# build main application image target
149150
FROM --platform=linux/amd64 debian:bullseye-20241111-slim AS build-app
@@ -216,22 +217,14 @@ RUN install -d -m 0755 -o nobody -g nogroup /app/batch_results
216217
# some js/css files use a separate script to generate minimized versions
217218
# storage these in a place for django to find
218219
RUN mkdir -p /app/static_frontend
219-
# minimize JS files
220-
RUN python3 bin/frontend.py js
221-
# copy build/minimized CSS files from frontand stage
220+
# copy build/minimized CSS files from frontend stage
222221
COPY --from=frontend --chown=nobody:nogroup /app/static_frontend/css/*.css /app/static_frontend/css/
222+
# copy build/minimized JS files from frontend stage
223+
COPY --from=frontend --chown=nobody:nogroup /app/static_frontend/js/ /app/static_frontend/js/
223224

224225
# generate language files
225226
RUN python3 bin/pofiles.py to_django
226227

227-
# copy dependencies to rebuild CSS (postcss)
228-
COPY --from=frontend /usr/local/bin/ /usr/local/bin/
229-
COPY --from=frontend /usr/local/lib/node_modules /usr/local/lib/node_modules
230-
COPY --from=frontend /app/frontend/node_modules /app/frontend/node_modules
231-
232-
# copy browser reload module
233-
COPY --from=linttest-deps /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload
234-
235228
# use fake version to prevent building the next steps when only the version changes
236229
ENV SETUPTOOLS_SCM_PRETEND_VERSION=0.0.0-build0
237230

@@ -249,6 +242,19 @@ ENV SETUPTOOLS_SCM_PRETEND_VERSION=$RELEASE
249242
ENTRYPOINT [ "python3", "./manage.py"]
250243
CMD ["runserver", "0.0.0.0:8080"]
251244

245+
# app image with development tools for better live reloading
246+
FROM app AS app-dev
247+
248+
# required for compose `develop` mode file sync/copy
249+
USER root
250+
251+
# copy dependencies to rebuild CSS (postcss)
252+
COPY --from=frontend /usr/local/bin/ /usr/local/bin/
253+
COPY --from=frontend /usr/local/lib/node_modules /usr/local/lib/node_modules
254+
255+
# copy browser reload module
256+
COPY --from=linttest-deps /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload /usr/local/lib/python${PYTHON_VERSION}/dist-packages/django_browser_reload
257+
252258
# supplement application with unittest, lint dependencies
253259
FROM build-app AS linttest
254260
ARG PYTHON_VERSION

docker/compose.development.yaml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,21 @@ services:
1717
environment:
1818
- INTERNETNL_DOMAINNAME
1919

20-
webserver:
21-
build:
22-
context: ..
23-
dockerfile: docker/webserver.Dockerfile
24-
develop:
25-
watch:
26-
# auto rebuild/reload when config files change
27-
- path: ./webserver/
28-
action: rebuild
29-
3020
app:
31-
develop:
32-
watch:
33-
# auto rebuild/reload when CSS/JS changes
34-
- path: ../frontend/js
35-
action: sync+exec
36-
target: /app/frontend/js
37-
exec:
38-
command: python3 bin/frontend.py js
21+
build:
22+
target: app-dev
3923
# use Django runserver for better debug abilities during development
4024
entrypoint: ["/bin/bash"]
4125
# run CSS auto rebuild in the background and start devserver
4226
command:
4327
- "-c"
4428
- >
4529
if [ "$INTERNETNL_AUTORELOAD" = "True" ]; then
46-
# watch CSS files for rebuild
30+
# install npm dependencies and watch CSS and JS files for rebuild
4731
cd /app/frontend;
48-
npm run css:build:watch &
32+
# It's needed to install the rollup linux dependency
33+
npm install;
34+
npm run docker:watch &
4935
cd /app;
5036
# start development server with auto reloading
5137
./manage.py runserver 0.0.0.0:8080
@@ -60,8 +46,8 @@ services:
6046
- ../checks:/app/checks
6147
- ../interface:/app/interface
6248
- ../internetnl:/app/internetnl
63-
# mount CSS files so `css:build:watch` can detect changes an rebuild
64-
- ../frontend/css:/app/frontend/css
49+
# mount frontend files so build tools can detect changes and rebuild
50+
- ../frontend/src:/app/frontend/src
6551

6652
worker:
6753
volumes:

docker/webserver.Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ RUN mkdir -p /var/www/internet.nl/.well-known/
3434
# copy all security*.txt files
3535
COPY .well-known/security*.txt /var/www/internet.nl/.well-known/
3636
COPY interface/static/favicon.ico /var/www/internet.nl/
37+
COPY interface/static/favicon.svg /var/www/internet.nl/
38+
COPY interface/static/favicon.png /var/www/internet.nl/
3739

3840
COPY docker/webserver/nginx_templates/* /etc/nginx/templates/
3941
COPY docker/webserver/mime.types /etc/nginx/

docker/webserver/nginx_templates/app.conf.template

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,6 @@ server {
178178

179179
proxy_set_header REMOTE-USER $remote_user;
180180

181-
# forward client IP for rate limiting on tasks (see `redis_id.py` `req_limit`)
182-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
183-
184181
include /etc/nginx/conf.d/basic_auth.include;
185182
# set proxy_pass argument for 'app' container as variable, this way nginx doesn't fail when 'app' is unresolvable at startup
186183
set $app http://app:8080;
@@ -220,8 +217,6 @@ server {
220217
# pass host for Django's allowed_hosts
221218
proxy_set_header Host $host;
222219
proxy_set_header X-Forwarded-Proto $scheme;
223-
# forward client IP for rate limiting on tasks (see `redis_id.py` `req_limit`)
224-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
225220
# set proxy_pass argument for 'app' container as variable, this way nginx doesn't fail when 'app' is unresolvable at startup
226221
set $app http://app:8080;
227222
proxy_pass $app;
@@ -249,6 +244,12 @@ server {
249244
location = /favicon.ico {
250245
alias /var/www/internet.nl/favicon.ico;
251246
}
247+
location = /favicon.svg {
248+
alias /var/www/internet.nl/favicon.svg;
249+
}
250+
location = /favicon.png {
251+
alias /var/www/internet.nl/favicon.png;
252+
}
252253

253254
# static files served from app
254255
location /static {

documentation/images/dockerfiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
Packages("certbot"),
5757
File("webserver/authentication.sh,webserver/tls_init.sh"),
5858
File("webserver/nginx_templates"),
59-
File("robots.txt,.well-known/security.txt,favicon.ico"),
59+
File("robots.txt,.well-known/security.txt,favicon.svg"),
6060
File("certbot/entrypoint.sh"),
6161
] >> Image("ghcr.io/internetstandards/webserver")
6262

frontend/.stylelintrc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
{ "extends": ["stylelint-config-standard"] }
1+
{
2+
"extends": [
3+
"stylelint-config-standard"
4+
],
5+
"rules": {
6+
"selector-type-no-unknown": null,
7+
"selector-pseudo-element-no-unknown": null,
8+
"selector-pseudo-class-no-unknown": null,
9+
"declaration-property-value-no-unknown": null,
10+
"no-descending-specificity": null
11+
}
12+
}

frontend/css/layers.css

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)