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

Celery frontend and backend fixed #29

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
48 changes: 27 additions & 21 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
FROM bitnami/minideb:buster

# Install dependencies
RUN install_packages git python python-pip python-setuptools python-dev build-essential wget gnupg2
RUN pip install python-dateutil
FROM ubuntu:noble
# # Install dependencies
RUN apt-get update && \
apt-get install -y git python3 python3-pip python3-dev build-essential wget python3-dateutil python3.12-venv

# Install Node.js / nodemon
RUN wget --no-check-certificate -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/node-8.9.3-0-linux-x64-debian-8.tar.gz && \
tar -zxf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -P --transform 's|^.*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz
ENV PATH="/opt/bitnami/node/bin:$PATH"
RUN npm install -g nodemon

# Install mongo shell
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - \
&& echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list \
&& apt-get update -y \
&& apt-get install -y mongodb-org-shell
RUN apt-get update && apt-get install -y curl && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install 16 && \
nvm alias default 16 && \
npm install -g nodemon

# # Install mongo shell
RUN apt-get update && \
apt-get install -y gnupg curl && \
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor && \
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" > /etc/apt/sources.list.d/mongodb-org-8.0.list && \
apt-get update && \
apt-get install -y mongodb-org

# Configuration
RUN mkdir -p /etc/kernelci
COPY app/kernelci-backend.cfg /etc/kernelci/kernelci-backend.cfg
RUN mkdir -p /etc/linaro
COPY app/kernelci-backend.cfg /etc/linaro/kernelci-backend.cfg

# Get source code
COPY kernelci-backend /srv/kernelci-backend

# Install python dependencies
RUN install_packages libyaml-dev # needed for yaml.CLoader
RUN pip install -r /srv/kernelci-backend/requirements.txt
RUN python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip && \
/venv/bin/pip install -r /srv/kernelci-backend/requirements.txt


EXPOSE 8888

Expand Down
44 changes: 27 additions & 17 deletions backend/Dockerfile-celery
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
FROM bitnami/minideb:buster
FROM python:3.8

# Install dependencies
RUN install_packages git python python-pip python-setuptools python-dev build-essential wget gnupg2
# Install Node.js / nodemon
RUN apt-get update && apt-get install -y curl && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install 16 && \
nvm alias default 16 && \
npm install -g nodemon

# ENV PATH="/opt/nodejs/bin:$PATH"

# RUN npm install -g nodemon

# Use non root user
RUN groupadd user && useradd --create-home --home-dir /home/user -g user user

# Configuration
COPY celery/celery-config.cfg /etc/kernelci/kernelci-celery.cfg
COPY app/kernelci-backend.cfg /etc/kernelci/kernelci-backend.cfg
COPY celery/celery-config.cfg /etc/linaro/kernelci-celery.cfg

# Logs folder
RUN mkdir -p /var/www/images/kernel-ci

# Copy backend source code
COPY kernelci-backend /srv/kernelci-backend
# Give additional rights on /var/www
RUN chown -R user:user /etc/linaro /var/www

# Copy backend source code and give rigth to user
COPY kernelci-backend /home/user/kernelci-backend
RUN chown -R user:user /home/user/kernelci-backend

# Install python dependencies
RUN install_packages libyaml-dev # needed for yaml.CLoader
RUN pip install -r /srv/kernelci-backend/requirements.txt

RUN pip install -v -r /home/user/kernelci-backend/requirements.txt

# Dedicated entrypoint
COPY celery/entrypoint.sh /srv/entrypoint.sh

# kcidb (NOTE: requires python3)
RUN install_packages python3 python3-pip python3-setuptools python3-dev
RUN git clone -b v5 https://github.com/kernelci/kcidb.git /etc/kernelci/kcidb; \
cd /etc/kernelci/kcidb; python3 -m pip install -r requirements.txt; \
python3 -m pip install --upgrade google-cloud-pubsub; \
python3 setup.py install

# Run application
# Run application using newly created user
USER user
CMD ["/srv/entrypoint.sh"]
2 changes: 1 addition & 1 deletion backend/kernelci-backend
Submodule kernelci-backend updated 97 files
+57 −0 .github/workflows/main.yml
+0 −28 .travis.yml
+1 −1 app/handlers/__init__.py
+0 −155 app/handlers/boot.py
+0 −110 app/handlers/boot_regressions.py
+0 −259 app/handlers/boot_trigger.py
+125 −0 app/handlers/build.py
+3 −14 app/handlers/callback.py
+0 −57 app/handlers/common/query.py
+0 −53 app/handlers/common/tests/test_query.py
+2 −0 app/handlers/count.py
+19 −59 app/handlers/dbindexes.py
+1 −2 app/handlers/job.py
+7 −59 app/handlers/send.py
+1 −1 app/handlers/test_group.py
+0 −152 app/handlers/tests/test_boot_handler.py
+0 −164 app/handlers/tests/test_boot_trigger_handler.py
+2 −11 app/handlers/tests/test_build_handler.py
+6 −6 app/handlers/tests/test_callback_handler.py
+2 −2 app/handlers/tests/test_count_handler.py
+2 −128 app/handlers/tests/test_send_handler.py
+19 −19 app/handlers/tests/test_test_group_handler.py
+14 −252 app/models/__init__.py
+0 −280 app/models/boot.py
+2 −0 app/models/build.py
+0 −8 app/models/stats.py
+0 −4 app/models/test_group.py
+0 −227 app/models/tests/test_boot_model.py
+3 −1 app/models/tests/test_build_model.py
+2 −2 app/models/tests/test_report_model.py
+0 −5 app/models/tests/test_stats_model.py
+0 −6 app/models/tests/test_test_group_model.py
+31 −2 app/taskqueue/celery.py
+0 −54 app/taskqueue/tasks/boot.py
+1 −1 app/taskqueue/tasks/build.py
+0 −17 app/taskqueue/tasks/callback.py
+7 −2 app/taskqueue/tasks/kcidb.py
+0 −54 app/taskqueue/tasks/report.py
+0 −6 app/tests/__init__.py
+0 −36 app/urls.py
+28 −30 app/utils/__init__.py
+0 −8 app/utils/batch/batch_op.py
+0 −2 app/utils/batch/common.py
+5 −17 app/utils/batch/tests/test_batch_common.py
+0 −13 app/utils/bisect/common.py
+15 −1 app/utils/bisect/test.py
+0 −483 app/utils/boot/__init__.py
+0 −446 app/utils/boot/regressions.py
+0 −482 app/utils/boot/tests/test_boot_import.py
+0 −194 app/utils/boot/tests/test_boot_regressions.py
+147 −374 app/utils/build/__init__.py
+182 −0 app/utils/build/tests/__init__.py
+3 −474 app/utils/build/tests/test_build_import.py
+1 −0 app/utils/callback/__init__.py
+588 −595 app/utils/callback/lava.py
+59 −0 app/utils/callback/lava_filters.py
+0 −0 app/utils/callback/tests/__init__.py
+23 −0 app/utils/callback/tests/data/auto-login-action.json
+23 −0 app/utils/callback/tests/data/lava-json-jetson-tk1.json
+24 −0 app/utils/callback/tests/data/lava-json-meson-gxbb-p200.json
+24 −0 app/utils/callback/tests/data/login-action.json
+24 −0 app/utils/callback/tests/data/unhandled_fault-login-status.json
+97 −0 app/utils/callback/tests/test_lava_callback.py
+16 −2 app/utils/db.py
+25 −0 app/utils/errors.py
+77 −135 app/utils/kci_test/__init__.py
+0 −1 app/utils/kci_test/regressions.py
+0 −7 app/utils/kci_test/tests/test_tests.py
+72 −28 app/utils/kcidb.py
+16 −12 app/utils/lava_log_parser.py
+13 −12 app/utils/log_parser.py
+0 −1,236 app/utils/report/boot.py
+95 −93 app/utils/report/build.py
+1 −11 app/utils/report/common.py
+0 −158 app/utils/report/templates/boot.html
+0 −107 app/utils/report/templates/boot.txt
+7 −0 app/utils/report/templates/build.txt
+25 −10 app/utils/report/templates/test.txt
+12 −7 app/utils/report/test.py
+0 −351 app/utils/report/tests/test_boot_report.py
+1 −1 app/utils/report/tests/test_build_report.py
+0 −4 app/utils/scripts/create-data.py
+0 −77 app/utils/scripts/fake_lava_v2_callback.py
+10 −29 app/utils/scripts/migrate-git-branch.py
+0 −1 app/utils/scripts/update-defconfig.py
+4 −48 app/utils/stats/daily.py
+3 −94 app/utils/stats/tests/test_daily_stats.py
+0 −9 app/utils/tests/test_base.py
+2 −2 app/utils/tests/test_log_parser.py
+0 −108 doc/collection-boot.rst
+0 −146 doc/collection-trigger-boot.rst
+0 −11 doc/collection-trigger.rst
+0 −1 doc/collections.rst
+0 −40 doc/intro.rst
+0 −67 doc/schema-boot-regressions.rst
+0 −52 doc/schema/1.0/get_boot_regressions.json
+20 −20 requirements.txt
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ services:
image: redis:3.2
restart: on-failure
mongo:
image: mongo:4.2
image: mongo:8.0
restart: on-failure
volumes:
- data:/data/db
Expand Down
24 changes: 11 additions & 13 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
FROM bitnami/minideb:buster
FROM bitnami/minideb:bullseye

# Install dependencies
RUN install_packages build-essential git python python3-pip python-dev uwsgi-plugin-python3 curl redis-tools wget

RUN install_packages build-essential git python python-pip python-setuptools python-dev uwsgi-plugin-python curl redis-tools wget

# Install Node.js / nodemon
RUN wget --no-check-certificate -nc -P /tmp/bitnami/pkg/cache/ https://downloads.bitnami.com/files/stacksmith/node-8.9.3-0-linux-x64-debian-8.tar.gz && \
tar -zxf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz -P --transform 's|^.*/files|/opt/bitnami|' --wildcards '*/files' && \
rm -rf /tmp/bitnami/pkg/cache/node-8.9.3-0-linux-x64-debian-8.tar.gz
ENV PATH="/opt/bitnami/node/bin:$PATH"
RUN npm install -g nodemon
RUN apt-get update && apt-get install -y curl && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.4/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install 16 && \
nvm alias default 16 && \
npm install -g nodemon

# Setup application

WORKDIR /srv
COPY kernelci-frontend /srv/kernelci-frontend
RUN pip install -r kernelci-frontend/requirements.txt
RUN pip install -r /srv/kernelci-frontend/requirements.txt
WORKDIR /srv/kernelci-frontend/app
RUN touch /etc/flask_settings
COPY flask_settings /etc/kernelci/kernelci-frontend.cfg
COPY flask_settings /etc/linaro/kernelci-frontend.cfg

# uWSGI configuration

EXPOSE 5000
COPY uwsgi.ini /srv/uwsgi.ini
COPY entrypoint.sh /srv/entrypoint.sh
Expand Down
2 changes: 1 addition & 1 deletion frontend/kernelci-frontend
Submodule kernelci-frontend updated 127 files
6 changes: 3 additions & 3 deletions proxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
FROM mhart/alpine-node:6.11.3 as frontend

RUN apk update && apk add git rsync
RUN git clone https://github.com/kernelci/kernelci-frontend.git front
RUN git clone https://github.com/krrish-sehgal/kernelci-frontend.git front
RUN node /front/app/dashboard/static/js/lib/r.js -o /front/app/dashboard/static/js/build.js

# API documentation

FROM bitnami/minideb:buster as backend
FROM ubuntu:noble as backend

RUN install_packages git python python-pip python-setuptools python-dev build-essential
RUN git clone https://github.com/kernelci/kernelci-backend.git /tmp/kernelci-backend
RUN git clone https://github.com/krrish-sehgal/kernelci-backend.git /tmp/kernelci-backend
RUN pip install -r /tmp/kernelci-backend/requirements.txt
RUN cd /tmp/kernelci-backend/doc && make html

Expand Down
2 changes: 1 addition & 1 deletion vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
config.vm.box = "debian/bullseye64"

# config.vm.network "forwarded_port", guest: 8080, host: 8080
# config.vm.network "forwarded_port", guest: 8081, host: 8081
Expand Down