Skip to content

Commit

Permalink
Fix bad merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Nov 22, 2024
1 parent 1246c8b commit e04d050
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 207 deletions.
43 changes: 29 additions & 14 deletions ckan-2.10/Dockerfile.py3.10
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,14 @@ RUN apt-get install --no-install-recommends -y \
supervisor && \
mkdir /etc/supervisord.d

COPY setup/supervisord.conf /etc
COPY setup/supervisord.py3.conf /etc/supervisord.conf

# Install uwsgi, the CKAN application, the dependency packages for CKAN plus some confiquration
RUN pip3 install -U pip && \
pip3 install uwsgi && \
cd ${SRC_DIR} && \
pip3 install -e git+${GIT_URL}@${CKAN_REF}#egg=ckan && \
cd ckan && \
cp who.ini ${APP_DIR} && \
pip3 install --no-binary markdown -r requirements.txt && \
# Install CKAN envvars to support loading config from environment variables
pip3 install -e git+https://github.com/okfn/ckanext-envvars.git@v0.0.6#egg=ckanext-envvars && \
Expand All @@ -86,19 +85,31 @@ RUN pip3 install -U pip && \
ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \
ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}"

# Create a local user and group plus set up the storage path
RUN groupadd -g 92 ckan && \
useradd -rm -d /srv/app -s /bin/bash -g ckan -u 92 ckan && \
mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${CKAN_STORAGE_PATH}

# Create ckan and ckan-sys users and the ckan-sys group plus set up the storage path
RUN groupadd -g 502 ckan-sys && \
useradd -rm -d /srv/app -s /bin/bash -g ckan-sys -u 502 ckan-sys && \
useradd -rm -d /srv/app -s /bin/bash -g ckan-sys -u 503 ckan

COPY setup/prerun.py ${APP_DIR}
COPY setup/start_ckan.sh ${APP_DIR}
ADD https://raw.githubusercontent.com/ckan/ckan/${CKAN_REF}/wsgi.py ${APP_DIR}
RUN chmod 644 ${APP_DIR}/wsgi.py

# Create entrypoint directory for children image scripts
ONBUILD RUN mkdir /docker-entrypoint.d
RUN mkdir -p /docker-entrypoint.d && chmod 755 /docker-entrypoint.d

# Set the ownership of the app directory, usr/local and the entrypoint directory to the ckan-sys user
RUN chown -R ckan-sys:ckan-sys ${APP_DIR} && \
chown -R ckan-sys:ckan-sys /docker-entrypoint.d && \
chown -R ckan-sys:ckan-sys /usr/local

# Set the ownership of the CKAN config file, src and the storage path to the ckan user
RUN chown ckan:ckan-sys ${APP_DIR}/ckan.ini && \
chown -R ckan:ckan-sys ${APP_DIR}/src && \
mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan-sys ${CKAN_STORAGE_PATH}

USER ckan

EXPOSE 5000

Expand All @@ -120,17 +131,21 @@ FROM base AS dev

ENV SRC_EXTENSIONS_DIR=${APP_DIR}/src_extensions

USER root

# Install CKAN dev requirements
RUN cd ${SRC_DIR}/ckan && \
pip3 install -r https://raw.githubusercontent.com/ckan/ckan/${CKAN_REF}/dev-requirements.txt

# Create folder for local extensions sources
RUN mkdir -p ${SRC_EXTENSIONS_DIR}
COPY --chown=ckan-sys:ckan-sys setup/unsafe.cert setup/unsafe.key setup/start_ckan_development.sh setup/install_src.sh ${APP_DIR}

# These are used to run https on development mode
COPY setup/unsafe.cert setup/unsafe.key ${APP_DIR}
# Update local directories
RUN mkdir -p ${SRC_EXTENSIONS_DIR} /var/lib/ckan && \
chown -R ckan-sys:ckan-sys ${SRC_EXTENSIONS_DIR} && \
chown -R ckan:ckan-sys /var/lib/ckan/ && \
chmod 775 ${SRC_EXTENSIONS_DIR}

COPY setup/start_ckan_development.sh ${APP_DIR}
USER ckan

CMD ["/srv/app/start_ckan_development.sh"]

Expand Down
4 changes: 0 additions & 4 deletions ckan-2.10/setup/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
<<<<<<< HEAD
chown = nobody:nogroup
=======
chown = ckan:ckan-sys
>>>>>>> main

[supervisord]
logfile = /tmp/supervisord.log
Expand Down
23 changes: 23 additions & 0 deletions ckan-2.10/setup/supervisord.py3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown = ckan:ckan-sys

[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = true
umask = 022
identifier = supervisor

[supervisorctl]
serverurl = unix:///tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[include]
files = /etc/supervisord.d/*.conf
43 changes: 31 additions & 12 deletions ckan-2.9/Dockerfile.py3.9
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ RUN apt-get install --no-install-recommends -y \
supervisor && \
mkdir /etc/supervisord.d

COPY setup/supervisord.conf /etc
COPY setup/supervisord.py3.conf /etc/supervisord.conf

# Install uwsgi, the CKAN application, the dependency packages for CKAN plus some confiquration

Expand All @@ -91,19 +91,31 @@ RUN pip3 install "webassets==0.12.1" && \
ckan config-tool ${CKAN_INI} "beaker.session.secret = " && \
ckan config-tool ${CKAN_INI} "ckan.plugins = ${CKAN__PLUGINS}"

# Create a local user and group plus set up the storage path
RUN groupadd -g 92 ckan && \
useradd -rm -d /srv/app -s /bin/bash -g ckan -u 92 ckan && \
mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan ${CKAN_STORAGE_PATH}
# Create ckan and ckan-sys users and the ckan-sys group plus set up the storage path
RUN groupadd -g 502 ckan-sys && \
useradd -rm -d /srv/app -s /bin/bash -g ckan-sys -u 502 ckan-sys && \
useradd -rm -d /srv/app -s /bin/bash -g ckan-sys -u 503 ckan

COPY setup/prerun.py ${APP_DIR}
COPY setup/start_ckan.sh ${APP_DIR}
ADD https://raw.githubusercontent.com/ckan/ckan/${CKAN_REF}/wsgi.py ${APP_DIR}
RUN chmod 644 ${APP_DIR}/wsgi.py

# Create entrypoint directory for children image scripts
ONBUILD RUN mkdir /docker-entrypoint.d
RUN mkdir -p /docker-entrypoint.d && chmod 755 /docker-entrypoint.d

# Set the ownership of the app directory, usr/local and the entrypoint directory to the ckan-sys user
RUN chown -R ckan-sys:ckan-sys ${APP_DIR} && \
chown -R ckan-sys:ckan-sys /docker-entrypoint.d && \
chown -R ckan-sys:ckan-sys /usr/local

# Set the ownership of the CKAN config file, src and the storage path to the ckan user
RUN chown ckan:ckan-sys ${APP_DIR}/ckan.ini && \
chown -R ckan:ckan-sys ${APP_DIR}/src && \
mkdir -p ${CKAN_STORAGE_PATH} && \
chown -R ckan:ckan-sys ${CKAN_STORAGE_PATH}

USER ckan

EXPOSE 5000

Expand All @@ -124,18 +136,25 @@ FROM base AS dev

ENV SRC_EXTENSIONS_DIR=${APP_DIR}/src_extensions

USER root

# Install CKAN dev requirements
#RUN . ${APP_DIR}/bin/activate && \
RUN cd ${SRC_DIR}/ckan && \
pip3 install -r https://raw.githubusercontent.com/ckan/ckan/${CKAN_REF}/dev-requirements.txt

# Create folder for local extensions sources
RUN mkdir -p ${SRC_EXTENSIONS_DIR}
# TODO: remove if requirements upgraded upstream
RUN pip3 install -U pytest-rerunfailures

COPY --chown=ckan-sys:ckan-sys setup/unsafe.cert setup/unsafe.key setup/start_ckan_development.sh setup/install_src.sh ${APP_DIR}

# These are used to run https on development mode
COPY setup/unsafe.cert setup/unsafe.key ${APP_DIR}
# Update local directories
RUN mkdir -p ${SRC_EXTENSIONS_DIR} /var/lib/ckan && \
chown -R ckan-sys:ckan-sys ${SRC_EXTENSIONS_DIR} && \
chown -R ckan:ckan-sys /var/lib/ckan/ && \
chmod 775 ${SRC_EXTENSIONS_DIR}

COPY setup/start_ckan_development.sh ${APP_DIR}
USER ckan

CMD ["/srv/app/start_ckan_development.sh"]

Expand Down
2 changes: 1 addition & 1 deletion ckan-2.9/setup/supervisord.conf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown = ckan:ckan-sys
chown = nobody:nogroup

[supervisord]
logfile = /tmp/supervisord.log
Expand Down
23 changes: 23 additions & 0 deletions ckan-2.9/setup/supervisord.py3.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[unix_http_server]
file = /tmp/supervisor.sock
chmod = 0777
chown = ckan:ckan-sys

[supervisord]
logfile = /tmp/supervisord.log
logfile_maxbytes = 50MB
logfile_backups=10
loglevel = info
pidfile = /tmp/supervisord.pid
nodaemon = true
umask = 022
identifier = supervisor

[supervisorctl]
serverurl = unix:///tmp/supervisor.sock

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[include]
files = /etc/supervisord.d/*.conf
Loading

0 comments on commit e04d050

Please sign in to comment.