Migration from Fig to Docker-compose
This commit is contained in:
parent
2e6d9957c4
commit
870ad50343
66
docker-compose.yml
Executable file
66
docker-compose.yml
Executable file
@ -0,0 +1,66 @@
|
|||||||
|
data:
|
||||||
|
build: docker/data
|
||||||
|
hostname: data
|
||||||
|
domainname: localdomain
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
build: docker/postgres
|
||||||
|
hostname: postgres
|
||||||
|
domainname: localdomain
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes_from:
|
||||||
|
- data
|
||||||
|
environment:
|
||||||
|
- CKAN_PASS=ckan_pass
|
||||||
|
- DATASTORE_PASS=datastore_pass
|
||||||
|
|
||||||
|
solr:
|
||||||
|
build: docker/solr
|
||||||
|
hostname: solr
|
||||||
|
domainname: localdomain
|
||||||
|
ports:
|
||||||
|
- "8983:8983"
|
||||||
|
volumes:
|
||||||
|
- /home/pyaillet/Projects/Ckan/ckan-docker/_src/ckan/ckan/config/solr/schema.xml:/opt/solr/example/solr/ckan/conf/schema.xml
|
||||||
|
|
||||||
|
datapusher:
|
||||||
|
build: _service-provider/_datapusher
|
||||||
|
hostname: datapusher
|
||||||
|
domainname: localdomain
|
||||||
|
ports:
|
||||||
|
- "8800:8800"
|
||||||
|
|
||||||
|
ckan:
|
||||||
|
build: .
|
||||||
|
hostname: ckan
|
||||||
|
domainname: localdomain
|
||||||
|
ports:
|
||||||
|
- "2222:22"
|
||||||
|
- "5000:5000"
|
||||||
|
- "8080:80"
|
||||||
|
links:
|
||||||
|
- postgres:postgres
|
||||||
|
- solr:solr
|
||||||
|
- datapusher:datapusher
|
||||||
|
command: /sbin/my_init --enable-insecure-key
|
||||||
|
volumes_from:
|
||||||
|
- data
|
||||||
|
volumes:
|
||||||
|
- /home/pyaillet/Projects/Ckan/ckan-docker/_src:/usr/lib/ckan/default/src
|
||||||
|
- /home/pyaillet/Projects/Ckan/ckan-docker/_etc/ckan/custom_options.ini:/etc/ckan/default/custom_options.ini
|
||||||
|
- /home/pyaillet/Projects/Ckan/ckan-docker/_etc/supervisor/conf.d:/etc/supervisor/conf.d
|
||||||
|
|
||||||
|
nginx:
|
||||||
|
build: docker/nginx
|
||||||
|
hostname: nginx
|
||||||
|
domainname: localdomain
|
||||||
|
links:
|
||||||
|
- ckan:ckan
|
||||||
|
ports:
|
||||||
|
- "80:80"
|
||||||
|
volumes:
|
||||||
|
- /home/pyaillet/Projects/Ckan/ckan-docker/docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
21
docker/compose/Dockerfile
Executable file
21
docker/compose/Dockerfile
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
FROM phusion/baseimage:0.9.16
|
||||||
|
MAINTAINER Open Knowledge
|
||||||
|
|
||||||
|
# set UTF-8 locale
|
||||||
|
RUN locale-gen en_US.UTF-8 && \
|
||||||
|
echo 'LANG="en_US.UTF-8"' > /etc/default/locale
|
||||||
|
|
||||||
|
RUN apt-get -qq update
|
||||||
|
|
||||||
|
# Install required packages
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt-get -qq -y install \
|
||||||
|
python-pip
|
||||||
|
|
||||||
|
|
||||||
|
RUN pip install -U docker-compose
|
||||||
|
ENV DOCKER_HOST unix:///tmp/docker.sock
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
CMD ["/bin/bash"]
|
||||||
|
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
74
docker/compose/README.md
Normal file
74
docker/compose/README.md
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
Fig
|
||||||
|
===
|
||||||
|
|
||||||
|
The Fig container runs Fig version 1.0 & the latest Docker within a container.
|
||||||
|
|
||||||
|
# Usage:
|
||||||
|
|
||||||
|
The Docker socket needs to be mounted as a volume to control Docker on the host. A source folder must be mounted to access the fig definition
|
||||||
|
|
||||||
|
|
||||||
|
## Build & Run
|
||||||
|
|
||||||
|
_Move to the `ckan-docker` directory_
|
||||||
|
|
||||||
|
- Build it:
|
||||||
|
|
||||||
|
_Build the Docker image from `docker/fig/Dockerfile`, and call it "fig_container"_
|
||||||
|
|
||||||
|
docker build --tag="fig_container" docker/fig
|
||||||
|
|
||||||
|
- Run it:
|
||||||
|
|
||||||
|
_Start the a container based on the `fig_container` Docker image_
|
||||||
|
|
||||||
|
docker run -it -d --name="fig-ckan" -p 2375 -v /var/run/docker.sock:/tmp/docker.sock -v $(pwd):/src fig_container
|
||||||
|
|
||||||
|
- Set the source volume path to yours.
|
||||||
|
|
||||||
|
_In the fig container fig won't work with relative path, because the mount namespace is different, you need to change the relative path to absolute path_
|
||||||
|
|
||||||
|
for example, change the `./`:
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- ./_src:/usr/lib/ckan/default/src
|
||||||
|
|
||||||
|
to an absolute path to you ckan-docker directory: `/Users/username/git/ckan/ckan-docker/`
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /Users/username/git/ckan/ckan-docker/_src:/usr/lib/ckan/default/src
|
||||||
|
|
||||||
|
- Build the Docker images & run the containers:
|
||||||
|
|
||||||
|
Send the `fig up` command to the fig container
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig up
|
||||||
|
|
||||||
|
|
||||||
|
## Using the Fig container
|
||||||
|
|
||||||
|
You can use amy fig command by pre-pending the `docker exec -it fig-ckan` command to any fig command
|
||||||
|
|
||||||
|
### build & start / recreate
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig up
|
||||||
|
|
||||||
|
### stop it
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig stop
|
||||||
|
|
||||||
|
### start it
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig start
|
||||||
|
|
||||||
|
### delete the containers
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig rm
|
||||||
|
|
||||||
|
### build new images
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig build
|
||||||
|
|
||||||
|
### logs
|
||||||
|
|
||||||
|
docker exec -it fig-ckan fig logs
|
||||||
Loading…
x
Reference in New Issue
Block a user