Skip to content

Commit

Permalink
Add docker VOLUMES
Browse files Browse the repository at this point in the history
smarter wait for database to spin up in init script
  • Loading branch information
kosarko committed Oct 17, 2019
1 parent d057574 commit 92d9e07
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.sw[pon]
*.pyc
tests/selenium-screenshot-*.png
tests/log.html
tests/output.xml
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,17 @@ EXPOSE 8000:8000


FROM base as copied
USER root
COPY dspace-src /srv/dspace-src
USER developer
WORKDIR /srv/dspace-src/utilities/project_helpers/scripts
RUN make install_libs deploy_guru && rm -rf /srv/dspace-src ~/.m2

FROM base as final
USER root
COPY --from=copied /srv/dspace /srv/dspace
COPY --from=copied /opt/lindat-common /opt/lindat-common
USER root
run mkdir /srv/dspace/assetstore && mkdir /srv/dspace/log && chown -R developer:developer /srv
USER developer
WORKDIR /srv/dspace

CMD ["/usr/local/tomcat/bin/catalina.sh", "jpda", "run"]
VOLUME ["/srv/dspace/assetstore", "/srv/dspace/log", "/srv/dspace/solr"]
11 changes: 11 additions & 0 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
tty: true
stdin_open: true
platform: linux
volumes:
- pgdata:/var/lib/postgresql/data
# DSpace
dspace-dev:
build:
Expand All @@ -23,3 +25,12 @@ services:
tty: true
stdin_open: true
platform: linux
volumes:
- assetstore:/srv/dspace/assetstore
- solr:/srv/dspace/solr
- log:/srv/dspace/log
volumes:
pgdata:
assetstore:
solr:
log:
14 changes: 14 additions & 0 deletions dspace_after_install_init/init.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
#!/bin/bash
set -o verbose
set -o xtrace
function init_repo {
for i in `seq 1 11`; do
if psql -t -U dspace -h postgres -c 'select 1;' >/dev/null; then
break
else
>&2 echo "Waiting for the database ${i}s"
sleep 1
fi
done
if [ $i -eq 11 ]; then
>&2 echo "Couldn't connect to database under 10s."
exit 1
fi
adm_email=`psql -t -U dspace -h postgres -c 'select email from eperson where eperson_id = 1;'`
if [ -z "$adm_email" ]; then
[email protected]
Expand Down

0 comments on commit 92d9e07

Please sign in to comment.