Skip to content

Commit ffb33c7

Browse files
committed
Upgrade to python 3.9 and cleanup
1 parent 07f74bc commit ffb33c7

9 files changed

+44
-41
lines changed

.deep-dive.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
search:
22
exclude_files:
3-
python3libs: '/usr/lib/python3\.8.*'
3+
python3libs: '/usr/lib/python3\.9.*'
44
files:
55
python: '.*\.pyc?'
66
json: '.*\.json'

Dockerfile.circle-enterprise

+6-11
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,11 @@ RUN apk --update --no-cache add \
1818
COPY . /app
1919
WORKDIR /app
2020

21-
# Build bootloader for alpine
22-
RUN git clone --depth 1 --single-branch --branch v3.5 https://github.com/pyinstaller/pyinstaller.git /tmp/pyinstaller \
23-
&& cd /tmp/pyinstaller/bootloader \
24-
&& CFLAGS="-Wno-stringop-overflow" python ./waf configure --no-lsb all \
25-
&& pip install .. \
26-
&& rm -Rf /tmp/pyinstaller
2721

28-
# install cython
29-
RUN pip install cython==3.0a1
30-
RUN pip install PyCrypto==2.6.1
22+
RUN pip install pyinstaller
23+
# install cython
24+
RUN pip install cython==3.0a9
25+
RUN pip install tinyaes
3126

3227
# set settings module
3328
ENV DJANGO_SETTINGS_MODULE "codecov.settings_enterprise"
@@ -55,7 +50,6 @@ COPY enterprise/ldd /pyinstaller/ldd
5550
COPY enterprise/setup.py setup.py
5651
COPY enterprise/cythonize.sh /pyinstaller/cythonize_everything.sh
5752

58-
COPY enterprise/package.sh /pyinstaller/package.sh
5953
COPY enterprise/pyi_rth_django.py /pyinstaller/pyi_rth_django.py
6054
COPY enterprise/generate_pyinstaller_args.py /pyinstaller/generate_pyinstaller_args.py
6155

@@ -66,6 +60,7 @@ COPY enterprise/hooks /hooks
6660
RUN chmod a+x /pyinstaller/*
6761
RUN ["/pyinstaller/cythonize_everything.sh"]
6862

63+
COPY enterprise/package.sh /pyinstaller/package.sh
6964
RUN chmod a+x /pyinstaller/*
7065
RUN ["/pyinstaller/package.sh"]
7166
ENV RUN_ENV=ENTERPRISE
@@ -82,7 +77,7 @@ RUN chown codecov:application /home/enterprise.sh && \
8277
chown codecov:application /home/api
8378

8479

85-
FROM alpine:3.13
80+
FROM alpine:3.14
8681

8782
RUN addgroup -S application && adduser -S codecov -G application && rm -rf /home/codecov
8883
USER codecov

Dockerfile.enterprise

+12-10
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ RUN apk --update --no-cache add \
1414
&& pip install --upgrade pip
1515

1616
# Build bootloader for alpine
17-
RUN git clone --depth 1 --single-branch --branch v3.5 https://github.com/pyinstaller/pyinstaller.git /tmp/pyinstaller \
18-
&& cd /tmp/pyinstaller/bootloader \
19-
&& CFLAGS="-Wno-stringop-overflow" python ./waf configure --no-lsb all \
20-
&& pip install .. \
21-
&& rm -Rf /tmp/pyinstaller
22-
17+
#RUN git clone --depth 1 --single-branch --branch v3.5 https://github.com/pyinstaller/pyinstaller.git /tmp/pyinstaller \
18+
# && cd /tmp/pyinstaller/bootloader \
19+
# && CFLAGS="-Wno-stringop-overflow" python ./waf configure --no-lsb all \
20+
# && pip install .. \
21+
# && rm -Rf /tmp/pyinstaller
22+
RUN pip install pyinstaller
2323
# install cython
24-
RUN pip install cython==3.0a1
25-
RUN pip install PyCrypto==2.6.1
24+
RUN pip install cython==3.0a9
25+
RUN pip install tinyaes
2626

2727
# set settings module
2828
ENV DJANGO_SETTINGS_MODULE "codecov.settings_enterprise"
@@ -50,7 +50,7 @@ COPY enterprise/ldd /pyinstaller/ldd
5050
COPY enterprise/setup.py setup.py
5151
COPY enterprise/cythonize.sh /pyinstaller/cythonize_everything.sh
5252

53-
COPY enterprise/package.sh /pyinstaller/package.sh
53+
5454
COPY enterprise/pyi_rth_django.py /pyinstaller/pyi_rth_django.py
5555
COPY enterprise/generate_pyinstaller_args.py /pyinstaller/generate_pyinstaller_args.py
5656

@@ -61,6 +61,8 @@ COPY enterprise/hooks /hooks
6161
RUN chmod a+x /pyinstaller/*
6262
RUN ["/pyinstaller/cythonize_everything.sh"]
6363

64+
RUN pip install tinyaes
65+
COPY enterprise/package.sh /pyinstaller/package.sh
6466
RUN chmod a+x /pyinstaller/*
6567
RUN ["/pyinstaller/package.sh"]
6668
ENV RUN_ENV=ENTERPRISE
@@ -76,7 +78,7 @@ RUN chown codecov:application /home/enterprise.sh && \
7678
chmod +x /home/enterprise.sh && \
7779
chown codecov:application /home/api
7880

79-
FROM alpine:3.13
81+
FROM alpine:3.14
8082

8183
RUN addgroup -S application && adduser -S codecov -G application
8284
RUN rm -rf /home/codecov

docker-compose.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3"
22

33
services:
44
api:
5-
image: codecov/api:latest
5+
image: codecov/enterprise-api:v4.6.2
66
networks:
77
- codecovapi
88
ports:
@@ -14,8 +14,8 @@ services:
1414
depends_on:
1515
- postgres
1616
- redis
17-
entrypoint:
18-
- ./dev.sh
17+
# entrypoint:
18+
# - ./api
1919
volumes:
2020
- ./:/app
2121
environment:
@@ -27,7 +27,9 @@ services:
2727
networks:
2828
- codecovapi
2929
ports:
30-
- "5432:5432"
30+
- "5436:5432"
31+
environment:
32+
- POSTGRES_PASSWORD=postgres
3133
redis:
3234
image: redis:4.0-alpine
3335
volumes:

enterprise/generate_pyinstaller_args.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
finder = ModuleFinder()
99

10-
so_extension = ".cpython-37m-x86_64-linux-gnu.so"
10+
so_extension = ".cpython-39-x86_64-linux-gnu.so"
1111

1212

1313
def get_relevant_paths(path):
@@ -31,9 +31,13 @@ def get_relevant_dirs(path):
3131

3232

3333
def find_imported_modules(filename):
34-
finder.run_script(filename)
35-
for name, mod in finder.modules.items():
36-
yield name
34+
try:
35+
finder.run_script(filename)
36+
for name, mod in finder.modules.items():
37+
yield name
38+
except AttributeError:
39+
pass
40+
3741

3842

3943
def generate_files_to_be_cythonized():
@@ -85,6 +89,7 @@ def main():
8589
"whitenoise",
8690
"whitenoise.middleware",
8791
"graphql_api",
92+
"graphql_api.types.enums",
8893
"legacy_migrations",
8994
"legacy_migrations.migrations",
9095
"shared.celery_config",

enterprise/package.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22
# Simple wrapper around pyinstaller
33
set -e
4-
set -x
4+
#set -x
55

66
# Generate a random key for encryption
77
random_key=$(pwgen -s 16 1)
@@ -10,13 +10,13 @@ random_key=$(pwgen -s 16 1)
1010
PATH="/pyinstaller:$PATH"
1111

1212
args_to_use=$(cat /pyinstaller/installer_args.txt)
13-
echo $(find . -name "*.so")
13+
#echo $(find . -name "*.so")
1414

1515
mkdir src
1616
echo 'true' > src/is_enterprise
1717

1818
# # Exclude pycrypto and PyInstaller from built packages
19-
pyinstaller -F --exclude-module pycrypto --exclude-module PyInstaller --add-data src:/src --name api --clean --key $random_key ${args_to_use} ${pyinstaller_args} /app/manage.py
19+
pyinstaller -F --exclude-module PyInstaller --add-data src:/src --name api --clean --key ${random_key} ${args_to_use} ${pyinstaller_args} /app/manage.py
2020

2121
cat api.spec
2222

@@ -28,4 +28,4 @@ rm -rf /hooks
2828
mv -v app/dist/* /home
2929
rm -rf /app
3030
rm -rf /pyinstaller
31-
rm -rf /usr/local/lib/python3.8/site-packages
31+
rm -rf /usr/local/lib/python3.9/site-packages

graphql_api/types/enums/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
OrderingDirection,
55
PullRequestState,
66
RepositoryOrdering,
7+
TypeProjectOnboarding,
8+
GoalOnboarding
79
)

prod.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if [ -f "/usr/local/bin/berglas" ]; then
88
fi
99

1010
if [ $ELASTIC_APM_ENABLED ]; then
11-
$prefix gunicorn codecov.wsgi:application --workers=2 --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT}
11+
$prefix gunicorn codecov.wsgi:application --workers=${GUNICORN_WORKERS:-3} --threads=${GUNICORN_THREADS:-6} --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT}
1212
else
13-
$prefix ddtrace-run gunicorn codecov.wsgi:application --workers=2 --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT}
13+
$prefix ddtrace-run gunicorn codecov.wsgi:application --workers=${GUNICORN_WORKERS:-3} --threads=${GUNICORN_THREADS:-6} --bind 0.0.0.0:8000 --access-logfile '-' --statsd-host ${STATSD_HOST}:${STATSD_PORT}
1414
fi

staging.sh

+2-5
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,5 @@ suffix=""
1212
if [[ "$STATSD_HOST" ]]; then
1313
suffix="--statsd-host ${STATSD_HOST}:${STATSD_PORT}"
1414
fi
15-
if [ $ELASTIC_APM_ENABLED ]; then
16-
$prefix gunicorn codecov.wsgi:application --reload --bind 0.0.0.0:8000 --access-logfile '-' $suffix
17-
else
18-
$prefix ddtrace-run gunicorn codecov.wsgi:application --reload --bind 0.0.0.0:8000 --access-logfile '-' $suffix
19-
fi
15+
16+
$prefix gunicorn codecov.wsgi:application --reload --workers=${GUNICORN_WORKERS:-3} --threads=${GUNICORN_THREADS:-6} --worker-class=gthread --bind 0.0.0.0:8000 --access-logfile '-' $suffix

0 commit comments

Comments
 (0)