more commits

This commit is contained in:
Brett 2022-07-13 18:36:14 +02:00
parent 089bcf590c
commit 3615c96614
6 changed files with 118 additions and 53 deletions

34
ckan/Dockerfile.dev Normal file
View File

@ -0,0 +1,34 @@
FROM ckan/ckan-base:2.9.5-dev
# Set up environment variables
ENV APP_DIR=/srv/app
ENV TZ=UTC
RUN echo ${TZ} > /etc/timezone
# Make sure both files are not exactly the same
RUN if ! [ /usr/share/zoneinfo/${TZ} -ef /etc/localtime ]; then \
cp /usr/share/zoneinfo/${TZ} /etc/localtime ;\
fi ;
# Install any extensions needed by your CKAN instance
# (Make sure to add the plugins to CKAN__PLUGINS in the .env file)
# For instance:
#RUN pip install -e git+https://github.com/ckan/ckanext-pages.git#egg=ckanext-pages && \
# pip install -e git+https://github.com/ckan/ckanext-dcat.git@v0.0.6#egg=ckanext-dcat && \
# pip install -r https://raw.githubusercontent.com/ckan/ckanext-dcat/v0.0.6/requirements.txt
# Clone the extension(s) your are writing for your own project in the `src` folder
# to get them mounted in this image at runtime
# Apply any patches needed to CKAN core or any of the built extensions (not the
# runtime mounted ones)
COPY patches ${APP_DIR}/patches
RUN for d in $APP_DIR/patches/*; do \
if [ -d $d ]; then \
for f in `ls $d/*.patch | sort -g`; do \
cd $SRC_DIR/`basename "$d"` && echo "$0: Applying patch $f to $SRC_DIR/`basename $d`"; patch -p1 < "$f" ; \
done ; \
fi ; \
done

View File

@ -1,7 +1,16 @@
version: "3"
volumes:
ckan_config:
ckan_home:
ckan_storage:
pg_data:
solr_data:
services:
ckan-dev:
container_name: ${CKAN_CONTAINER_NAME}
build:
context: ckan/
dockerfile: Dockerfile.dev
@ -9,47 +18,63 @@ services:
- TZ=${TZ}
env_file:
- .env
links:
- db
- solr
- redis
- datapusher
depends_on:
db:
condition: service_healthy
solr:
condition: service_healthy
redis:
condition: service_healthy
ports:
- "0.0.0.0:${CKAN_PORT}:5000"
volumes:
- ./src:/srv/app/src_extensions
- ckan_config:/etc/ckan
- ckan_home:/usr/lib/ckan
- ckan_storage:/var/lib/ckan
- ./src:/srv/app/src_extensions
restart: unless-stopped
#healthcheck:
# test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:5000"]
datapusher:
container_name: datapusher
image: kowhai/datapusher:0.0.17
container_name: ${DATAPUSHER_CONTAINER_NAME}
build:
context: datapusher/
args:
- DATAPUSHER_VERSION=${DATAPUSHER_VERSION}
ports:
- "8800:8800"
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8800"]
db:
container_name: db
env_file:
- .env
container_name: ${POSTGRESQL_CONTAINER_NAME}
build:
context: postgresql/
args:
- DATASTORE_READONLY_PASSWORD=${DATASTORE_READONLY_PASSWORD}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
environment:
- DATASTORE_READONLY_PASSWORD=${DATASTORE_READONLY_PASSWORD}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- PGDATA=/var/lib/postgresql/data/db
volumes:
- pg_data:/var/lib/postgresql/data
restart: unless-stopped
healthcheck:
test: ["CMD", "pg_isready", "-U", "ckan"]
solr:
container_name: solr
build:
context: solr/
ports:
- "8983:8983"
volumes:
- solr_data:/opt/solr/server/solr/ckan/data/index
container_name: ${SOLR_CONTAINER_NAME}
image: ckan/ckan-solr:${SOLR_IMAGE_VERSION}
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:8983/solr/"]
redis:
container_name: redis
image: redis:alpine
volumes:
ckan_storage:
pg_data:
solr_data:
container_name: ${REDIS_CONTAINER_NAME}
image: redis:${REDIS_VERSION}
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "-e", "QUIT"]

View File

@ -14,8 +14,9 @@ services:
build:
context: nginx/
dockerfile: Dockerfile
#links:
# - ckan
#depends_on:
# ckan:
# condition: service_healthy
ports:
- "0.0.0.0:81:80"

View File

@ -2,12 +2,7 @@ FROM nginx:stable-alpine
ENV NGINX_DIR=/etc/nginx
RUN mkdir -p ${NGINX_DIR}/sites-available
RUN mkdir -p ${NGINX_DIR}/sites-enabled
COPY setup/index.html /usr/share/nginx/html/index.html
COPY setup/sites-available/* ${NGINX_DIR}/sites-available
RUN ln -s ${NGINX_DIR}/sites-available/ckan.conf ${NGINX_DIR}/sites-enabled/ckan.conf
COPY setup/*.conf ${NGINX_DIR}/conf.d/
EXPOSE 81

28
nginx/setup/default.conf Normal file
View File

@ -0,0 +1,28 @@
server {
listen 80;
listen [::]:80;
server_name localhost;
#access_log /var/log/nginx/host.access.log main;
location / {
proxy_pass http://ckan:5000/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
#proxy_cache cache;
proxy_cache_bypass $cookie_auth_tkt;
proxy_no_cache $cookie_auth_tkt;
proxy_cache_valid 30m;
proxy_cache_key $host$scheme$proxy_host$request_uri;
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View File

@ -1,18 +0,0 @@
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m;
proxy_temp_path /tmp/nginx_proxy 1 2;
server {
client_max_body_size 100M;
location / {
#proxy_pass http://ckan:5000/;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
proxy_cache cache;
proxy_cache_bypass $cookie_auth_tkt;
proxy_no_cache $cookie_auth_tkt;
proxy_cache_valid 30m;
proxy_cache_key $host$scheme$proxy_host$request_uri;
# In emergency comment out line to force caching
# proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
}
}