Skip to content

Commit 522ac51

Browse files
authored
Merge pull request #4888 from kobotoolbox/django-kobocat-app
Make Kobocat a Django app inside KPI
2 parents 0fcb003 + 1b75bc6 commit 522ac51

File tree

862 files changed

+70051
-835
lines changed

Some content is hidden

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

862 files changed

+70051
-835
lines changed

.github/workflows/pytest.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ jobs:
1919
SERVICE_ACCOUNT_BACKEND_URL: redis://localhost:6379/4
2020
CACHE_URL: redis://localhost:6379/3
2121
ENKETO_REDIS_MAIN_URL: redis://localhost:6379/0
22+
KOBOCAT_MEDIA_ROOT: /tmp/test_media
2223
strategy:
2324
matrix:
24-
python-version: ['3.8', '3.10', '3.12']
25+
python-version: ['3.8', '3.10']
2526
services:
2627
postgres:
2728
image: postgis/postgis:14-3.4

Dockerfile

+4-25
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ ENV KPI_LOGS_DIR=/srv/logs \
2929
TMP_DIR=/srv/tmp \
3030
UWSGI_USER=kobo \
3131
UWSGI_GROUP=kobo \
32-
SERVICES_DIR=/etc/service \
33-
CELERY_PID_DIR=/var/run/celery \
3432
INIT_PATH=/srv/init
3533

3634
##########################################
@@ -40,13 +38,7 @@ ENV KPI_LOGS_DIR=/srv/logs \
4038
RUN mkdir -p "${NGINX_STATIC_DIR}" && \
4139
mkdir -p "${KPI_SRC_DIR}" && \
4240
mkdir -p "${KPI_NODE_PATH}" && \
43-
mkdir -p "${TMP_DIR}" && \
44-
mkdir -p ${CELERY_PID_DIR} && \
45-
mkdir -p ${SERVICES_DIR}/uwsgi && \
46-
mkdir -p ${SERVICES_DIR}/celery && \
47-
mkdir -p ${SERVICES_DIR}/celery_low_priority && \
48-
mkdir -p ${SERVICES_DIR}/celery_beat && \
49-
mkdir -p "${INIT_PATH}"
41+
mkdir -p "${TMP_DIR}"
5042

5143
##########################################
5244
# Install `apt` packages. #
@@ -63,6 +55,7 @@ RUN apt-get -qq update && \
6355
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" \
6456
| tee /etc/apt/sources.list.d/nodesource.list && \
6557
apt-get -qq update && \
58+
apt-get -qq -y install openjdk-17-jre && \
6659
apt-get -qq -y install --no-install-recommends \
6760
ffmpeg \
6861
gdal-bin \
@@ -76,7 +69,6 @@ RUN apt-get -qq update && \
7669
postgresql-client \
7770
procps \
7871
rsync \
79-
runit-init \
8072
vim-tiny \
8173
wait-for-it && \
8274
apt-get clean && \
@@ -161,28 +153,15 @@ RUN echo "export PATH=${PATH}" >> /etc/profile && \
161153
echo 'source /etc/profile' >> /root/.bashrc && \
162154
echo 'source /etc/profile' >> /home/${UWSGI_USER}/.bashrc
163155

164-
165-
# Remove getty* services to avoid errors of absent tty at sv start-up
166-
RUN rm -rf /etc/runit/runsvdir/default/getty-tty*
167-
168-
# Create symlinks for runsv services
169-
RUN ln -s "${KPI_SRC_DIR}/docker/run_uwsgi.bash" "${SERVICES_DIR}/uwsgi/run" && \
170-
ln -s "${KPI_SRC_DIR}/docker/run_celery.bash" "${SERVICES_DIR}/celery/run" && \
171-
ln -s "${KPI_SRC_DIR}/docker/run_celery_low_priority.bash" "${SERVICES_DIR}/celery_low_priority/run" && \
172-
ln -s "${KPI_SRC_DIR}/docker/run_celery_beat.bash" "${SERVICES_DIR}/celery_beat/run"
173-
174-
175156
# Add/Restore `UWSGI_USER`'s permissions
176157
# chown of `${TMP_DIR}/.npm` is a hack needed for kobo-install-based staging deployments;
177158
# see internal discussion at https://chat.kobotoolbox.org/#narrow/stream/4-Kobo-Dev/topic/Unu.2C.20du.2C.20tri.2C.20kvar.20deployments/near/322075
178-
RUN chown -R ":${UWSGI_GROUP}" ${CELERY_PID_DIR} && \
179-
chmod g+w ${CELERY_PID_DIR} && \
180-
chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${KPI_SRC_DIR}/emails/ && \
159+
RUN chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${KPI_SRC_DIR}/emails/ && \
181160
chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${KPI_LOGS_DIR} && \
182161
chown -R "${UWSGI_USER}:${UWSGI_GROUP}" ${TMP_DIR} && \
183162
chown -R root:root "${TMP_DIR}/.npm"
184163

185164

186165
EXPOSE 8000
187166

188-
CMD ["/bin/bash", "-c", "exec ${KPI_SRC_DIR}/docker/init.bash"]
167+
CMD ["/bin/bash", "docker/entrypoint.sh"]

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,17 @@
66

77
We're open for [contributions](./CONTRIBUTING.md)!
88

9+
## Important notice when upgrading from any release older than [`2.024.19`](https://github.com/kobotoolbox/kpi/releases/tag/2.024.19)
10+
11+
Prior to release [`2.024.19`](https://github.com/kobotoolbox/kpi/releases/tag/2.024.19), this project (KPI) and [KoboCAT](https://github.com/kobotoolbox/kobocat) were two separated projects.
12+
KoboCAT is now part of KPI code base and its repository has been archived.
13+
14+
KoboCAT deprecation notices will be maintained in this repository.
15+
[More details here](./kobo/apps/openrosa/README.md)
16+
917
## Important notice when upgrading from any release older than [`2.020.18`](https://github.com/kobotoolbox/kpi/releases/tag/2.020.18)
1018

11-
Prior to release [`2.020.18`](https://github.com/kobotoolbox/kpi/releases/tag/2.020.18), this project (KPI) and [KoBoCAT](https://github.com/kobotoolbox/kobocat) both shared a common Postgres database. They now each have their own. **If you are upgrading an existing single-database installation, you must follow [these instructions](https://community.kobotoolbox.org/t/upgrading-to-separate-databases-for-kpi-and-kobocat/7202)** to migrate the KPI tables to a new database and adjust your configuration appropriately.
19+
Prior to release [`2.020.18`](https://github.com/kobotoolbox/kpi/releases/tag/2.020.18), this project (KPI) and [KoboCAT](https://github.com/kobotoolbox/kobocat) both shared a common Postgres database. They now each have their own. **If you are upgrading an existing single-database installation, you must follow [these instructions](https://community.kobotoolbox.org/t/upgrading-to-separate-databases-for-kpi-and-kobocat/7202)** to migrate the KPI tables to a new database and adjust your configuration appropriately.
1220

1321
If you do not want to upgrade at this time, please use the [`shared-database-obsolete`](https://github.com/kobotoolbox/kpi/tree/shared-database-obsolete) branch instead.
1422

@@ -35,7 +43,7 @@ syntax, see the documentation at the top of
3543

3644
## Admin reports
3745

38-
There are several types of data reports available to superusers.
46+
There are several types of data reports available to superusers.
3947
* Full list of users including their details provided during signup, number of deployed projects (XForm count), number of submissions, date joined, and last login: `<kpi base url>/superuser_stats/user_report/`. File being created is a CSV, so don't download immediately to wait for server to be finished writing to the file (it will download even if incomplete).
4048
* Monthly aggregate figures for number of forms, deployed projects, and submissions (from kobocat): `<kc server domain>/<superuser username>/superuser_stats/`
4149

dependencies/pip/dev_requirements.in

+5
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@ pytest
1111
pytest-cov
1212
pytest-django
1313
pytest-env
14+
15+
16+
# Kobocat
17+
httmock
18+
simplejson

0 commit comments

Comments
 (0)