Skip to content

Commit c0c8771

Browse files
Merge branch 'main' into main-merge
# Conflicts: # .devcontainer/docker-compose.extend.yml # .github/workflows/build-test-base.yml # .github/workflows/build.yml # README.md # docker/app.Dockerfile # docker/configs/settings_local.py # docker/docker-compose.extend.yml # docker/scripts/app-init.sh # ietf/release/tests.py # ietf/release/urls.py # ietf/templates/500.html # ietf/templates/api/index.html # ietf/templates/base.html # ietf/templates/base/menu.html # ietf/templates/group/group_about_status_edit.html # ietf/templates/meeting/agenda_filter.html # ietf/templates/release/about.html # ietf/utils/tests.py # package-lock.json
2 parents 8783872 + 902e37d commit c0c8771

11 files changed

Lines changed: 183 additions & 102 deletions

File tree

.github/workflows/dev-db-nightly.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,17 @@ name: Nightly Dev DB Image
77

88
# Controls when the workflow will run
99
on:
10+
# Run every night
1011
schedule:
1112
- cron: '0 0 * * *'
1213

14+
# Run on db.Dockerfile changes
15+
push:
16+
branches:
17+
- main
18+
paths:
19+
- 'docker/db.Dockerfile'
20+
1321
# Allows you to run this workflow manually from the Actions tab
1422
workflow_dispatch:
1523

dev/docker-test-base/Dockerfile

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
FROM python:3.6-bullseye
2+
LABEL maintainer="IETF Tools Team <tools-discuss@ietf.org>"
3+
4+
ENV DEBIAN_FRONTEND=noninteractive
5+
6+
7+
RUN apt-get update
8+
RUN apt-get -qy upgrade
9+
10+
# Add Node.js Source
11+
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
12+
13+
# Add Docker Source
14+
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
15+
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
16+
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
17+
18+
# Install the packages we need
19+
RUN apt-get update
20+
RUN apt-get install -qy \
21+
apache2-utils \
22+
apt-file \
23+
apt-utils \
24+
bash \
25+
build-essential \
26+
curl \
27+
docker-ce-cli \
28+
enscript \
29+
gawk \
30+
gcc \
31+
ghostscript \
32+
git \
33+
gnupg \
34+
graphviz \
35+
jq \
36+
less \
37+
libcairo2-dev \
38+
libgtk2.0-0 \
39+
libgtk-3-0 \
40+
libnotify-dev \
41+
libgconf-2-4 \
42+
libgbm-dev \
43+
libnss3 \
44+
libxss1 \
45+
libasound2 \
46+
libxtst6 \
47+
libmagic-dev \
48+
libmariadb-dev \
49+
libtidy-dev \
50+
locales \
51+
mariadb-client \
52+
netcat \
53+
nodejs \
54+
pigz \
55+
pv \
56+
python3-ipython \
57+
ripgrep \
58+
rsync \
59+
rsyslog \
60+
ruby \
61+
ruby-rubygems \
62+
unzip \
63+
wget \
64+
xauth \
65+
xvfb \
66+
yang-tools
67+
68+
# Install kramdown-rfc2629 (ruby)
69+
RUN gem install kramdown-rfc2629
70+
71+
# Install chromedriver
72+
COPY docker/scripts/app-install-chromedriver.sh /tmp/app-install-chromedriver.sh
73+
RUN sed -i 's/\r$//' /tmp/app-install-chromedriver.sh && \
74+
chmod +x /tmp/app-install-chromedriver.sh
75+
RUN /tmp/app-install-chromedriver.sh
76+
77+
# Get rid of installation files we don't need in the image, to reduce size
78+
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
79+
80+
# "fake" dbus address to prevent errors
81+
# https://github.com/SeleniumHQ/docker-selenium/issues/87
82+
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
83+
84+
# avoid million NPM install messages
85+
ENV npm_config_loglevel warn
86+
# allow installing when the main user is root
87+
ENV npm_config_unsafe_perm true
88+
# disable NPM funding messages
89+
ENV npm_config_fund false
90+
91+
# Set locale to en_US.UTF-8
92+
RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
93+
echo "en_US.UTF-8 UTF-8" >> /etc/locale.gen && \
94+
echo "LANG=en_US.UTF-8" > /etc/locale.conf && \
95+
dpkg-reconfigure locales && \
96+
locale-gen en_US.UTF-8 && \
97+
update-locale LC_ALL en_US.UTF-8
98+
ENV LC_ALL en_US.UTF-8
99+
100+
# Install idnits
101+
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
102+
RUN chmod +rx /usr/local/bin/idnits
103+
104+
# Install current datatracker python dependencies
105+
COPY requirements.txt /tmp/pip-tmp/
106+
RUN pip3 --disable-pip-version-check --no-cache-dir install -r /tmp/pip-tmp/requirements.txt \
107+
&& rm -rf /tmp/pip-tmp
108+
109+
# Turn off rsyslog kernel logging (doesn't work in Docker)
110+
RUN sed -i '/imklog/s/^/#/' /etc/rsyslog.conf
111+
112+
# Fetch wait-for utility
113+
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
114+
RUN chmod +rx /usr/local/bin/wait-for
115+
116+
# Create workspace
117+
RUN mkdir -p /workspace
118+
WORKDIR /workspace
119+
120+
# Install NPM modules
121+
COPY package.json package.json
122+
RUN npm install --no-audit
123+
RUN rm -f package.json package-lock.json

docker/app.Dockerfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ RUN echo "LC_ALL=en_US.UTF-8" >> /etc/environment && \
110110
update-locale LC_ALL en_US.UTF-8
111111
ENV LC_ALL en_US.UTF-8
112112

113+
# Install grunt
114+
RUN npm install -g grunt-cli
115+
113116
# Install idnits
114117
ADD https://raw.githubusercontent.com/ietf-tools/idnits-mirror/main/idnits /usr/local/bin/
115118
RUN chmod +rx /usr/local/bin/idnits
@@ -131,6 +134,9 @@ ADD https://github.com/validator/validator/releases/download/latest/vnu.jar /
131134
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
132135
RUN chmod +rx /usr/local/bin/wait-for
133136

137+
ADD https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for /usr/local/bin/
138+
RUN chmod +rx /usr/local/bin/wait-for
139+
134140
# Copy the startup file
135141
COPY docker/scripts/app-init.sh /docker-init.sh
136142
RUN sed -i 's/\r$//' /docker-init.sh && \

ietf/release/tests.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
from ietf.utils.test_utils import TestCase
1212

1313
class ReleasePagesTest(TestCase):
14-
15-
1614
def test_about(self):
1715
url = reverse('ietf.release.views.release')+"about"
1816
r = self.client.get(url)

ietf/submit/forms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from ietf.message.models import Message
3434
from ietf.name.models import FormalLanguageName, GroupTypeName
3535
from ietf.submit.models import Submission, Preapproval
36-
from ietf.submit.utils import validate_submission_name, validate_submission_rev, validate_submission_document_date
36+
from ietf.submit.utils import validate_submission_name, validate_submission_rev, validate_submission_document_date, remote_ip
3737
from ietf.submit.parsers.pdf_parser import PDFParser
3838
from ietf.submit.parsers.plain_parser import PlainParser
3939
from ietf.submit.parsers.xml_parser import XMLParser
@@ -47,7 +47,7 @@ class SubmissionBaseUploadForm(forms.Form):
4747
def __init__(self, request, *args, **kwargs):
4848
super(SubmissionBaseUploadForm, self).__init__(*args, **kwargs)
4949

50-
self.remote_ip = request.META.get('REMOTE_ADDR', None)
50+
self.remote_ip = remote_ip(request)
5151

5252
self.request = request
5353
self.in_first_cut_off = False

ietf/submit/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,3 +1030,12 @@ def update_submission_external_resources(submission, new_resources):
10301030
for new_res in new_resources:
10311031
new_res.submission = submission
10321032
new_res.save()
1033+
1034+
def remote_ip(request):
1035+
if 'CF-Connecting-IP' in request.META:
1036+
remote_ip = request.META.get('CF-Connecting-IP')
1037+
elif 'X-Forwarded-For' in request.META:
1038+
remote_ip = request.META.get('X-Forwarded-For').split(',')[0]
1039+
else:
1040+
remote_ip = request.META.get('REMOTE_ADDR', None)
1041+
return remote_ip

ietf/submit/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
post_submission, cancel_submission, rename_submission_files, remove_submission_files, get_draft_meta,
4040
get_submission, fill_in_submission, apply_checkers, save_files,
4141
check_submission_revision_consistency, accept_submission, accept_submission_requires_group_approval,
42-
accept_submission_requires_prev_auth_approval, update_submission_external_resources )
42+
accept_submission_requires_prev_auth_approval, update_submission_external_resources, remote_ip )
4343
from ietf.stats.utils import clean_country_name
4444
from ietf.utils.accesstoken import generate_access_token
4545
from ietf.utils.log import log
@@ -729,7 +729,7 @@ def add_manualpost_email(request, submission_id=None, access_token=None):
729729

730730
submission, submission_email_event = (
731731
add_submission_email(request=request,
732-
remote_ip=request.META.get('REMOTE_ADDR', None),
732+
remote_ip=remote_ip(request),
733733
name = form.draft_name,
734734
rev=form.revision,
735735
submission_pk = submission_pk,

ietf/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@
152152
});
153153
</script>
154154
</body>
155-
</html>
155+
</html>

ietf/templates/base/menu.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,4 +420,4 @@
420420
{% endif %}
421421
{% if flavor == 'top' %}
422422
{% include "base/menu_user.html" %}
423-
{% endif %}
423+
{% endif %}

0 commit comments

Comments
 (0)