gitblit-org/gitblit-docker

Persistent data storage

Closed this issue · 5 comments

I'm trying to get gitblit to run with persistent storage, since I don't want to lose all my data/repositories when I restart the container.

I tried
docker run --name gitblit_persistent --rm -it -v ~/composeBuildserver/gitblit/:/opt/gitblit-data/ jmoger/gitblit

But this gives me the following error in gitblit
Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.moxie.MxLauncher.main(MxLauncher.java:129) Caused by: java.lang.RuntimeException: Password required! at com.gitblit.utils.X509Utils$X509Metadata.<init>(X509Utils.java:204) at com.gitblit.GitBlitServer.start(GitBlitServer.java:260) at com.gitblit.GitBlitServer.main(GitBlitServer.java:124)

Do you know any solution to this?

Have you tried setting up a VOLUME?

guyou@45e5d06

I tried adding VOLUME /opt/gitblit and mount it, but I got an error message saying it couldnt find the gitblit jar. If I just tried /opt/gitblit-data, I got the same error as above.

It looks like it can not find the keystore password which likely means it can't find gitblit.properties. Do you have a gitblit.properties file in /opt/gitblit-data or whichever data folder you are specifying?

I'm experiencing the same problem. My solution was this:

First, let GitBlit initialize itself with the /opt/gitblit-data inside the container:

docker run -d --name gitblit -p 8443:443 -p 8080:80 -p 9418:9418 -p 29418:29418 -v /root/data/gitblit:/opt/gitblit-data-temp jmoger/gitblit

Then, move the contents of /opt/gitblit-data into /opt/gitblit-data-temp:

docker exec -ti gitblit bash
# wait to get a shell in the container
cp -R /opt/gitblit-data/* /opt/gitblit-data-temp
exit

Stop and delete the container

docker stop gitblit
docker rm gitblit

Create a new container with the volume we just populated:

docker run -d --name gitblit -p 8443:443 -p 8080:80 -p 9418:9418 -p 29418:29418 -v /root/data/gitblit:/opt/gitblit-data jmoger/gitblit

@andrewrothman: Check out https://hub.docker.com/r/jacekkow/gitblit/ - it populates data dir automatically (disclaimer: I'm the author).