how to make the stardog database save files in /storage

3 views
Skip to first unread message

alex....@gmail.com

unread,
Oct 20, 2015, 7:19:08 PM10/20/15
to Stardog
Hi,

I'm running stardog on a docker container and want to have STARDOG_HOME to be /stardog and would like the database files to be saved in the /storage volume.

I've been looking through the documentation but don't see how to do this.

I had tried to set STARDOG_HOME to be the same as a VOLUME in docker container however then the CMD to start stardog would not work and it didn't seem to work. It was also the WORKDIR so maybe there is some issue with that setup.

let me know your thoughts
Regards
Alex

Michael Grove

unread,
Oct 20, 2015, 7:38:54 PM10/20/15
to stardog
On Tue, Oct 20, 2015 at 7:19 PM, <alex....@gmail.com> wrote:
Hi,

I'm running stardog on a docker container and want to have STARDOG_HOME to be /stardog and would like the database files to be saved in the /storage volume.

STARDOG_HOME is where the databases are stored.  If you set that to /storage, it will store them there.  Are you trying to have /stardog contain the binaries?  If so, just add /stardog/bin to your PATH variable and you should be good to go.  

Cheers,

Mike
 

I've been looking through the documentation but don't see how to do this.

I had tried to set STARDOG_HOME to be the same as a VOLUME in docker container however then the CMD to start stardog would not work and it didn't seem to work. It was also the WORKDIR so maybe there is some issue with that setup.

let me know your thoughts
Regards
Alex

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Alex Muir

unread,
Oct 20, 2015, 7:53:48 PM10/20/15
to sta...@clarkparsia.com

On Tue, Oct 20, 2015 at 11:38 PM, Michael Grove <mi...@complexible.com> wrote:
STARDOG_HOME is where the databases are stored.  If you set that to /storage, it will store them there.  Are you trying to have /stardog contain the binaries?  If so, just add /stardog/bin to your PATH variable and you should be good to go.  

Oh okay,, I tried that in docker,, but when I set both the WORKDIR and VOLUME to the same directory I would get an error in that the CMD could not run. CMD bin/stardog-admin server start... I'd have to test again to get the exact message. But related to /bin/sh and not being able to execute the script.

I thought maybe there was a way to separate the /bin from the database data.

WORKDIR /stardog_home
VOLUME /stardog_home




FROM platform_oraclejava8

MAINTAINER Alex Muir <al...@tilogeo.com>

#STARDOG
   
WORKDIR /
VOLUME /storage
ENV DATA_DIR /data
RUN mkdir /data
RUN mkdir /stardog
ENV STARDOG_JAVA_ARGS -Xms6g -Xmx6g -XX:MaxDirectMemorySize=12g
ENV STARDOG_HOME /stardog_home
ENV STARDOG_LOG_PATH /storage/log
COPY stardog.zip /stardog/stardog.zip
RUN unzip /stardog/stardog.zip
RUN mv /stardog-4.0-RC1/ /stardog_home/
COPY stardog-license-key.bin /stardog_home/stardog-license-key.bin

COPY database.properties /data/database.properties

#CLEANUP
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*  /stardog/

# Making stardog-admin and database files accessible to jenkins

WORKDIR /stardog_home

#VOLUME /stardog_home  <-- causes error

EXPOSE 5820

#RUN ln -snf /bin/bash /bin/sh

CMD bin/stardog-admin server start && \
    sleep 5 && \
    bin/stardog-admin db create -c /data/database.properties && \
    (tail -f stardog.log &) && \
    while (pidof java > /dev/null); do sleep 1; done


Regards
Alex
www.tilogeo.com

Michael Grove

unread,
Oct 20, 2015, 8:27:19 PM10/20/15
to stardog
On Tue, Oct 20, 2015 at 7:53 PM, Alex Muir <alex....@gmail.com> wrote:

On Tue, Oct 20, 2015 at 11:38 PM, Michael Grove <mi...@complexible.com> wrote:
STARDOG_HOME is where the databases are stored.  If you set that to /storage, it will store them there.  Are you trying to have /stardog contain the binaries?  If so, just add /stardog/bin to your PATH variable and you should be good to go.  

Oh okay,, I tried that in docker,, but when I set both the WORKDIR and VOLUME to the same directory I would get an error in that the CMD could not run. CMD bin/stardog-admin server start... I'd have to test again to get the exact message. But related to /bin/sh and not being able to execute the script.

I thought maybe there was a way to separate the /bin from the database data.

I don't know much about docker, but there's no reason that your install location of stardog, ie where the binaries are, needs to be the same as STARDOG_HOME, where the databases are stored.  I've always set them up separate, and I usually have symlinks so I can easily switch between versions.

Cheers,

Mike
 

--

Alex Muir

unread,
Oct 22, 2015, 5:19:02 AM10/22/15
to sta...@clarkparsia.com
Thanks Mike,

I admit I'm used to thinking of HOME to be a place where we find a bin folder which led to my confusion.

So for record.. I got it working although with one caveat,, I had to cp stardog-license-key.bin into the directory where i mapped the STARDOG_HOME volume /data/stardog as stardog would not see the one  that used COPY stardog-license-key.bin /storage/stardog-license-key.bin to place in the container. Probably some issue related to volumes that I need to read up on.

FROM platform_oraclejava8

MAINTAINER Alex Muir <al...@tilogeo.com>

#STARDOG
    
WORKDIR /

RUN mkdir -p /storage/logs
ENV STARDOG_HOME /storage


ENV DATA_DIR /data

RUN mkdir /data
RUN mkdir /properties
RUN mkdir /stardog

ENV STARDOG_JAVA_ARGS -Xms2g -Xmx2g -XX:MaxDirectMemorySize=3g


COPY stardog.zip /stardog/stardog.zip
RUN unzip /stardog/stardog.zip
RUN mv /stardog-4.0-RC1/ /stardog_binaries/

#Note must sudo cp stardog-license-key.bin /data/stardog as it is not recognized using COPY for some reason
COPY stardog-license-key.bin /storage/stardog-license-key.bin

COPY database.properties /properties/database.properties


#CLEANUP
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*  /stardog/


WORKDIR /stardog_binaries


# Making stardog-admin and database files accessible
VOLUME /storage
EXPOSE 5820


CMD bin/stardog-admin server start && \
    sleep 5 && \
    bin/stardog-admin db create -c /properties/database.properties && \
    (tail -f /storage/stardog.log &) && \

    while (pidof java > /dev/null); do sleep 1; done


Regards
Alex
www.tilogeo.com
Reply all
Reply to author
Forward
0 new messages