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
Docker BugFix #3346
Merged
Merged
Docker BugFix #3346
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
f0a1b7d
Solr BugFix
c2094e6
EntryPoint
59e04d6
Docker File Working as expected
43f90c3
Docker-Compose and Docker-Cloud Changed
2a949a4
Compose Up
2c22fd3
EntryPoint In /
6adc42a
chmod +x
9fecc96
DockerCompose
56e7beb
CircleCI Test Docker
a2dd96d
Save Redis and set name ok
196b3f5
BugFix on CircleCI
f9dcda0
Changed Exposed Port to don't collide with background tests
0466e5e
Sleep outside run
d802264
Added ENV for Storage and URL
f9a152c
Travis YML Added
bb7dc7a
Redis Cached
794fa5c
CircleCI - No Docker
794b687
Docker Show Info at end
8ba3375
Port 5000
c741569
Merge remote-tracking branch 'refs/remotes/ckan/master' into docker-u…
b05c43a
Using new ENV-VAR names
8b427fe
Merge remote-tracking branch 'refs/remotes/ckan/master' into docker-u…
01a2526
TMP-BUGFIX
3fea23e
Using ENV-VAR
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
sudo: required | ||
|
||
language: python | ||
|
||
services: | ||
- docker | ||
|
||
cache: | ||
directories: | ||
- ~/docker | ||
|
||
before_install: | ||
- if [[ -e ~/docker/postgresql.tar ]]; then docker load -i ~/docker/postgresql.tar; fi | ||
- if [[ -e ~/docker/solr.tar ]]; then docker load -i ~/docker/solr.tar; fi | ||
- if [[ -e ~/docker/redis.tar ]]; then docker load -i ~/docker/redis.tar; fi | ||
- if [[ -e ~/docker/ckan.tar ]]; then docker load -i ~/docker/ckan.tar; fi | ||
|
||
- docker build --rm=false -t postgresql ./contrib/docker/postgresql/ | ||
- docker build --rm=false -t solr ./contrib/docker/solr/ | ||
- docker pull redis:latest | ||
- docker build --rm=false -t ckan . | ||
|
||
- mkdir -p ~/docker; docker save postgresql > ~/docker/postgresql.tar | ||
- mkdir -p ~/docker; docker save solr > ~/docker/solr.tar | ||
- mkdir -p ~/docker; docker save redis:latest > ~/docker/redis.tar | ||
- mkdir -p ~/docker; docker save ckan > ~/docker/ckan.tar | ||
|
||
install: | ||
- docker run -d --name db postgresql | ||
- docker run -d --name solr solr | ||
- docker run -d --name redis redis:latest | ||
- docker run -d --name ckan -p 5000:5000 --link db:db --link redis:redis --link solr:solr ckan | ||
|
||
script: | ||
- docker ps -a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,49 @@ | ||
FROM phusion/baseimage:0.9.15 | ||
MAINTAINER Open Knowledge | ||
# docker build . -t ckan && docker run -d -p 80:5000 --link db:db --link redis:redis --link solr:solr ckan | ||
|
||
# Disable SSH | ||
RUN rm -rf /etc/service/sshd /etc/my_init.d/00_regen_ssh_host_keys.sh | ||
FROM debian:jessie | ||
MAINTAINER Open Knowledge | ||
|
||
ENV HOME /root | ||
ENV CKAN_HOME /usr/lib/ckan/default | ||
ENV CKAN_CONFIG /etc/ckan/default | ||
ENV CKAN_DATA /var/lib/ckan | ||
ENV CKAN_STORAGE_PATH /var/lib/ckan | ||
ENV CKAN_SITE_URL http://localhost:5000 | ||
|
||
# Install required packages | ||
RUN apt-get -q -y update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ | ||
python-minimal \ | ||
python-dev \ | ||
RUN apt-get -q -y update && apt-get -q -y upgrade && DEBIAN_FRONTEND=noninteractive apt-get -q -y install \ | ||
python-dev \ | ||
python-pip \ | ||
python-virtualenv \ | ||
libevent-dev \ | ||
libpq-dev \ | ||
nginx-light \ | ||
apache2 \ | ||
libapache2-mod-wsgi \ | ||
postfix \ | ||
build-essential && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# Install CKAN | ||
git-core \ | ||
&& apt-get -q clean | ||
|
||
# SetUp Virtual Environment CKAN | ||
RUN mkdir -p $CKAN_HOME $CKAN_CONFIG $CKAN_STORAGE_PATH | ||
RUN virtualenv $CKAN_HOME | ||
RUN mkdir -p $CKAN_HOME $CKAN_CONFIG $CKAN_DATA | ||
RUN chown www-data:www-data $CKAN_DATA | ||
RUN ln -s $CKAN_HOME/bin/pip /usr/local/bin/ckan-pip | ||
RUN ln -s $CKAN_HOME/bin/paster /usr/local/bin/ckan-paster | ||
|
||
# SetUp Requirements | ||
ADD ./requirements.txt $CKAN_HOME/src/ckan/requirements.txt | ||
RUN $CKAN_HOME/bin/pip install -r $CKAN_HOME/src/ckan/requirements.txt | ||
ADD . $CKAN_HOME/src/ckan/ | ||
RUN $CKAN_HOME/bin/pip install -e $CKAN_HOME/src/ckan/ | ||
RUN ln -s $CKAN_HOME/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini | ||
ADD ./contrib/docker/apache.wsgi $CKAN_CONFIG/apache.wsgi | ||
|
||
# Configure apache | ||
ADD ./contrib/docker/apache.conf /etc/apache2/sites-available/ckan_default.conf | ||
RUN echo "Listen 8080" > /etc/apache2/ports.conf | ||
RUN a2ensite ckan_default | ||
RUN a2dissite 000-default | ||
RUN ckan-pip install --upgrade -r $CKAN_HOME/src/ckan/requirements.txt | ||
|
||
# Configure nginx | ||
ADD ./contrib/docker/nginx.conf /etc/nginx/nginx.conf | ||
RUN mkdir /var/cache/nginx | ||
# TMP-BUGFIX https://github.com/ckan/ckan/issues/3388 | ||
ADD ./dev-requirements.txt $CKAN_HOME/src/ckan/dev-requirements.txt | ||
RUN ckan-pip install --upgrade -r $CKAN_HOME/src/ckan/dev-requirements.txt | ||
|
||
# Configure postfix | ||
ADD ./contrib/docker/main.cf /etc/postfix/main.cf | ||
# SetUp CKAN | ||
ADD . $CKAN_HOME/src/ckan/ | ||
RUN ckan-pip install -e $CKAN_HOME/src/ckan/ | ||
RUN ln -s $CKAN_HOME/src/ckan/ckan/config/who.ini $CKAN_CONFIG/who.ini | ||
|
||
# Configure runit | ||
ADD ./contrib/docker/my_init.d /etc/my_init.d | ||
ADD ./contrib/docker/svc /etc/service | ||
CMD ["/sbin/my_init"] | ||
# SetUp EntryPoint | ||
COPY ./contrib/docker/ckan-entrypoint.sh / | ||
RUN chmod +x /ckan-entrypoint.sh | ||
ENTRYPOINT ["/ckan-entrypoint.sh"] | ||
|
||
# Volumes | ||
VOLUME ["/etc/ckan/default"] | ||
VOLUME ["/var/lib/ckan"] | ||
EXPOSE 80 | ||
EXPOSE 5000 | ||
|
||
RUN rm -rf /tmp/* /var/tmp/* | ||
CMD ["ckan-paster","serve","/etc/ckan/default/ckan.ini"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# URL for the primary database, in the format expected by sqlalchemy (required | ||
# unless linked to a container called 'db') | ||
: ${CKAN_SQLALCHEMY_URL:=} | ||
# URL for solr (required unless linked to a container called 'solr') | ||
: ${CKAN_SOLR_URL:=} | ||
# URL for redis (required unless linked to a container called 'redis') | ||
: ${CKAN_REDIS_URL:=} | ||
|
||
CONFIG="${CKAN_CONFIG}/ckan.ini" | ||
|
||
abort () { | ||
echo "$@" >&2 | ||
exit 1 | ||
} | ||
|
||
write_config () { | ||
|
||
export CKAN_SQLALCHEMY_URL=${CKAN_SQLALCHEMY_URL} | ||
export CKAN_SOLR_URL=${CKAN_SOLR_URL} | ||
export CKAN_REDIS_URL=${CKAN_REDIS_URL} | ||
export CKAN_STORAGE_PATH=${CKAN_STORAGE_PATH} | ||
export CKAN_SITE_URL=${CKAN_SITE_URL} | ||
|
||
ckan-paster make-config ckan "$CONFIG" | ||
|
||
# In case want to use the config from ckan.ini use this | ||
#ckan-paster --plugin=ckan config-tool "$CONFIG" -e \ | ||
# "sqlalchemy.url = ${CKAN_SQLALCHEMY_URL}" \ | ||
# "solr_url = ${CKAN_SOLR_URL}" \ | ||
# "ckan.redis.url = ${CKAN_REDIS_URL}" \ | ||
# "ckan.storage_path = ${CKAN_STORAGE_PATH}" \ | ||
# "ckan.site_url = ${CKAN_SITE_URL}" | ||
} | ||
|
||
link_postgres_url () { | ||
local user=$DB_ENV_POSTGRES_USER | ||
local pass=$DB_ENV_POSTGRES_PASSWORD | ||
local db=$DB_ENV_POSTGRES_DB | ||
local host=$DB_PORT_5432_TCP_ADDR | ||
local port=$DB_PORT_5432_TCP_PORT | ||
echo "postgresql://${user}:${pass}@${host}:${port}/${db}" | ||
} | ||
|
||
link_solr_url () { | ||
local host=$SOLR_PORT_8983_TCP_ADDR | ||
local port=$SOLR_PORT_8983_TCP_PORT | ||
echo "http://${host}:${port}/solr/ckan" | ||
} | ||
|
||
link_redis_url () { | ||
local host=$REDIS_PORT_6379_TCP_ADDR | ||
local port=$REDIS_PORT_6379_TCP_PORT | ||
echo "redis://${host}:${port}/1" | ||
} | ||
|
||
# If we don't already have a config file, bootstrap | ||
if [ ! -e "$CONFIG" ]; then | ||
|
||
if [ -z "$CKAN_SQLALCHEMY_URL" ]; then | ||
if ! CKAN_SQLALCHEMY_URL=$(link_postgres_url); then | ||
abort "ERROR: no CKAN_SQLALCHEMY_URL specified and linked container called 'db' was not found" | ||
fi | ||
fi | ||
|
||
if [ -z "$CKAN_SOLR_URL" ]; then | ||
if ! CKAN_SOLR_URL=$(link_solr_url); then | ||
abort "ERROR: no CKAN_SOLR_URL specified and linked container called 'solr' was not found" | ||
fi | ||
fi | ||
|
||
if [ -z "$CKAN_REDIS_URL" ]; then | ||
if ! CKAN_REDIS_URL=$(link_redis_url); then | ||
abort "ERROR: no CKAN_REDIS_URL specified and linked container called 'redis' was not found" | ||
fi | ||
fi | ||
|
||
write_config | ||
|
||
fi | ||
|
||
# Initializes the Database | ||
ckan-paster --plugin=ckan db init -c "${CKAN_CONFIG}/ckan.ini" | ||
|
||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,28 @@ | ||
version: '2' | ||
services: | ||
ckan: | ||
container_name: ckan | ||
image: ckan/ckan:latest | ||
depends_on: | ||
# docker-compose build && docker-compose up | ||
ckan: | ||
container_name: ckan | ||
image: ckan/ckan:latest | ||
links: | ||
- db | ||
- solr | ||
links: | ||
- db | ||
- solr | ||
ports: | ||
- "80:80" | ||
db: | ||
container_name: db | ||
image: ckan/postgresql:latest | ||
solr: | ||
container_name: solr | ||
image: ckan/solr:latest | ||
- redis | ||
ports: | ||
- "80:5000" | ||
|
||
db: | ||
container_name: db | ||
image: ckan/postgresql:latest | ||
ports: | ||
- "5432:5432" | ||
|
||
solr: | ||
container_name: solr | ||
image: ckan/solr:latest | ||
ports: | ||
- "8983:8983" | ||
|
||
redis: | ||
container_name: redis | ||
image: redis:latest | ||
ports: | ||
- "6379:6379" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this will be need to be changed to the relevant tag as part of the release process? Also more generically I guess the release process will need to include a Docker step to build and tag the images and upload them to Docker Hub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@amercader For now i don't know how to make the diference between the schemas.
The best aproach is to set a managed schema. I will work on it ;)