mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2025-12-08 17:36:24 +00:00
launch a redis container if we can connect to the host docker
When the redis connection parameters are not specified, the image will try to spin up a redis container if it is able to communicate with the host docker. This is only possible if the following two options are specified in the docker run command: `-v /var/run/docker.sock:/run/docker.sock` `-v $(which docker):/bin/docker` This is primarily added to get the quick start guide to work without much of a hassel.
This commit is contained in:
parent
46ea17f956
commit
5e2d8014be
4
Makefile
4
Makefile
@ -16,8 +16,10 @@ build:
|
||||
start:
|
||||
@echo "Starting gitlab..."
|
||||
@docker run --name='gitlab-demo' -d \
|
||||
-p 10022:22 -p 10080:80 \
|
||||
-e 'GITLAB_PORT=10080' -e 'GITLAB_SSH_PORT=10022' \
|
||||
-p 10022:22 -p 10080:80 \
|
||||
-v /var/run/docker.sock:/run/docker.sock \
|
||||
-v $(shell which docker):/bin/docker \
|
||||
${USER}/gitlab:latest >/dev/null
|
||||
@echo "GitLab instance is booting up..."
|
||||
@echo "Please be patient. This could take a while..."
|
||||
|
||||
@ -153,8 +153,10 @@ Run the gitlab image
|
||||
|
||||
```bash
|
||||
docker run --name='gitlab' -it --rm \
|
||||
-p 10022:22 -p 10080:80 \
|
||||
-e 'GITLAB_PORT=10080' -e 'GITLAB_SSH_PORT=10022' \
|
||||
-p 10022:22 -p 10080:80 \
|
||||
-v /var/run/docker.sock:/run/docker.sock \
|
||||
-v $(which docker):/bin/docker \
|
||||
sameersbn/gitlab:7.2.2
|
||||
```
|
||||
|
||||
|
||||
27
assets/init
27
assets/init
@ -135,6 +135,33 @@ case "${DB_TYPE}" in
|
||||
*) echo "Unsupported database adapter. Available adapters are mysql and postgres." && exit 1 ;;
|
||||
esac
|
||||
|
||||
##
|
||||
## For the sake of getting the quick start guide to work,
|
||||
## we attempt to spin up a redis container if possible.
|
||||
##
|
||||
## NOTE: this is only meant for getting the quick start guide to work .
|
||||
##
|
||||
if [ -z "${REDIS_HOST}" -a -n "$(which docker)" -a -S /var/run/docker.sock ]; then
|
||||
echo "Redis connection details not specified."
|
||||
echo "Will try to spin up a new redis image with the name redis-gitlab."
|
||||
echo "Please manually configure the redis connection in production."
|
||||
case "$(docker inspect --format {{.State.Running}} redis-gitlab 2>/dev/null)" in
|
||||
true)
|
||||
echo "Using existing redis container..."
|
||||
;;
|
||||
false)
|
||||
echo "Starting up existing redis container..."
|
||||
docker start redis-gitlab >/dev/null 2>/dev/null
|
||||
;;
|
||||
*)
|
||||
echo "Starting up a new redis container..."
|
||||
docker run --name='redis-gitlab' -d sameersbn/redis:latest >/dev/null 2>/dev/null
|
||||
;;
|
||||
esac
|
||||
REDIS_HOST=$(docker inspect --format {{.NetworkSettings.IPAddress}} redis-gitlab 2>/dev/null)
|
||||
REDIS_PORT=6379
|
||||
fi
|
||||
|
||||
if [ -z "${REDIS_HOST}" ]; then
|
||||
echo "ERROR: "
|
||||
echo " Please configure the redis connection."
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user