Merge branch 'remove-internal-redis'

Refer #39
Refer #149
This commit is contained in:
Sameer Naik 2014-09-20 14:52:23 +05:30
commit acfa96bb5e
6 changed files with 74 additions and 40 deletions

View File

@ -1,6 +1,7 @@
# Changelog
**latest**
- removed internal redis server
- shutdown the container gracefully
**7.2.2**

View File

@ -3,7 +3,7 @@ MAINTAINER sameer@damagehead.com
RUN apt-get update \
&& apt-get install -y supervisor logrotate locales \
nginx openssh-server mysql-server redis-server \
nginx openssh-server mysql-server redis-tools \
git-core postgresql-client ruby rubygems \
python2.7 python-docutils \
libmysqlclient18 libpq5 zlib1g libyaml-0-2 libssl1.0.0 \

View File

@ -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..."

View File

@ -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
```
@ -203,13 +205,25 @@ GitLab uses a database backend to store its data. You can configure this image t
> **Warning**
>
> The internal mysql server will soon be removed from the image.
> Please use a linked [mysql](#linking-to-mysql-container) or
> [postgresql](#linking-to-postgresql-container) container instead.
> Or else connect with an external [mysql](#external-mysql-server) or
> [postgresql](#external-postgresql-server) server.
> You've been warned.
>
> Please use a [linked mysql](#linking-to-mysql-container) container or specify a connection to a [external mysql](#external-mysql-server) server.
>
> **You've been warned.**
>
> If you are already using the internal mysql server then follow these instructions to migrate to a linked mysql container:
>
> Assuming that your mysql data is available at `/opt/gitlab/mysql`
>
> ```bash
> docker run --name=mysql -d \
> -v /opt/gitlab/mysql:/var/lib/mysql \
> sameersbn/mysql:latest
> ```
> This will start a mysql container with your existing mysql data.
> All you need to do now is link this mysql container to the gitlab container using the `--link mysql:mysql` option.
>
> Refer to [Linking to MySQL Container](#linking-to-mysql-container) for more information.
>
This docker image is configured to use a MySQL database backend. The database connection can be configured using environment variables. If not specified, the image will start a mysql server internally and use it. However in this case, the data stored in the mysql database will be lost if the container is stopped/deleted. To avoid this you should mount a volume at `/var/lib/mysql`.
@ -441,18 +455,20 @@ docker run --name=gitlab -d --link postgresql:postgresql \
## Redis
GitLab uses the redis server for its key-value data store. The redis server connection details can be specified using environment variables.
### Internal Redis Server
> **Warning**
The internal redis server has been removed from the image. Please use a [linked redis](#linking-to-redis-container) container or specify a [external redis](#external-redis-server) connection.
> **Notice**
>
> The internal mysql server will also be removed in the next release.
>
> If you have been using the internal mysql server, then please migrate to a using a [linked mysql server](#linking-to-mysql-container) using the migration instructions listed [here](#internal-mysql-server).
>
> **You've been warned**
>
> 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

View File

@ -108,8 +108,7 @@ if [ -n "${REDISIO_PORT_6379_TCP_ADDR}" ]; then
REDIS_PORT=${REDIS_PORT:-${REDISIO_PORT_6379_TCP_PORT}}
fi
# fallback to using internal redis server
REDIS_HOST=${REDIS_HOST:-localhost}
# fallback to default redis port
REDIS_PORT=${REDIS_PORT:-6379}
# is a mysql or postgresql database linked?
@ -136,6 +135,41 @@ 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."
echo " Refer http://git.io/PMnRSw for more information."
echo " Cannot continue without a redis connection. Aborting..."
exit 1
fi
case "${GITLAB_HTTPS}" in
true)
GITLAB_PORT=${GITLAB_PORT:-443}
@ -262,11 +296,6 @@ if [ "${DB_HOST}" == "localhost" ]; then
fi
fi
if [ "${REDIS_HOST}" == "localhost" ]; then
echo "Starting redis server..."
supervisorctl start redis-server >/dev/null
fi
# configure git for the 'git' user
sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "${GITLAB_EMAIL}"

View File

@ -165,20 +165,6 @@ stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
EOF
# configure supervisord to start redis (manual)
sed 's/daemonize yes/daemonize no/' -i /etc/redis/redis.conf
cat > /etc/supervisor/conf.d/redis-server.conf <<EOF
[program:redis-server]
priority=20
directory=/tmp
command=/usr/bin/redis-server /etc/redis/redis.conf
user=redis
autostart=false
autorestart=true
stdout_logfile=/var/log/supervisor/%(program_name)s.log
stderr_logfile=/var/log/supervisor/%(program_name)s.log
EOF
# configure supervisord to start crond
cat > /etc/supervisor/conf.d/cron.conf <<EOF
[program:cron]