added support for linking to a redis container

This commit is contained in:
Sameer Naik 2014-04-21 21:48:43 +05:30
parent dcb373b3da
commit 9381aaf462
3 changed files with 64 additions and 2 deletions

View File

@ -1,6 +1,7 @@
# Changelog
**latest**
- added support for linking with redis container.
- use sameersbn/ubuntu as the base docker image
- install postgresql-client to fix restoring backups when used with a postgresql database backend.

View File

@ -19,6 +19,10 @@
- [PostgreSQL](#postgresql)
- [External PostgreSQL Server](#external-postgresql-server)
- [Linking to PostgreSQL Container](#linking-to-postgresql-container)
- [Redis](#redis)
- [Internal Redis Server](#internal-redis-server)
- [External Redis Server](#external-redis-server)
- [Linking to Redis Container](#linking-to-redis-container)
- [Mail](#mail)
- [Putting it all together](#putting-it-all-together)
- [Available Configuration Parameters](#available-configuration-parameters)
@ -348,6 +352,53 @@ docker run --name=gitlab -d --link postgresql:postgresql \
sameersbn/gitlab:latest
```
## Redis
### Internal Redis Server
> **Warning**
>
> The internal redis server will soon be removed from the image.
> Please use a linked [redis](#linking-to-redis-container) container
> or a external [redis](#external-redis-server) server
> You've been warned.
GitLab uses the redis server for its key-value data store. The redis server connection details can be specified using environment variables. If not specified, the starts a redis server internally, no additional configuration is required.
### External Redis Server
The image can be configured to use an external redis server instead of starting a redis server internally. The configuration should be specified using environment variables while starting the GitLab image.
*Assuming that the redis server host is 192.168.1.100*
```bash
docker run --name=gitlab -i -t --rm \
-e "REDIS_HOST=192.168.1.100" -e "REDIS_PORT=6379" \
sameersbn/gitlab:latest
```
### Linking to Redis Container
You can link this image with a redis container to satisfy gitlab's redis requirement. The alias of the redis server container should be set to **redisio** while linking with the gitlab image.
To illustrate linking with a redis container, we will use the [sameersbn/redis](https://github.com/sameersbn/docker-redis) image. Please refer the [README](https://github.com/sameersbn/docker-redis/blob/master/README.md) of docker-redis for details.
First, lets pull the redis image from the docker index.
```bash
docker pull sameersbn/redis:latest
```
Lets start the redis container
```bash
docker run --name=redis -d sameersbn/redis:latest
```
We are now ready to start the GitLab application.
```bash
docker run --name=gitlab -d --link redis:redisio \
sameersbn/gitlab:latest
```
### Mail
The mail configuration should be specified using environment variables while starting the GitLab image. The configuration defaults to using gmail to send emails and requires the specification of a valid username and password to login to the gmail servers.

View File

@ -14,8 +14,8 @@ GITLAB_BACKUP_EXPIRY=${GITLAB_BACKUP_EXPIRY:-}
GITLAB_SHELL_SSH_PORT=${GITLAB_SHELL_SSH_PORT:-22}
REDIS_HOST=${REDIS_HOST:-localhost}
REDIS_PORT=${REDIS_PORT:-6379}
REDIS_HOST=${REDIS_HOST:-}
REDIS_PORT=${REDIS_PORT:-}
UNICORN_WORKERS=${UNICORN_WORKERS:-2}
UNICORN_TIMEOUT=${UNICORN_TIMEOUT:-60}
@ -49,6 +49,16 @@ LDAP_ALLOW_USERNAME_OR_EMAIL_LOGIN=${LDAP_ALLOW_USERNAME_OR_EMAIL_LOGIN:-}
LDAP_BASE=${LDAP_BASE:-}
LDAP_USER_FILTER=${LDAP_USER_FILTER:-}
# is a redis container linked?
if [ -n "${REDISIO_PORT_6379_TCP_ADDR}" ]; then
REDIS_HOST=${REDIS_HOST:-${REDISIO_PORT_6379_TCP_ADDR}}
REDIS_PORT=${REDIS_PORT:-${REDISIO_PORT_6379_TCP_PORT}}
fi
# fallback to using internal redis server
REDIS_HOST=${REDIS_HOST:-localhost}
REDIS_PORT=${REDIS_PORT:-6379}
# is a mysql or postgresql database linked?
# requires that the mysql or postgresql containers have exposed
# port 3306 and 5432 respectively.