mirror of
https://github.com/sameersbn/docker-gitlab.git
synced 2026-01-18 13:58:25 +00:00
102 lines
2.9 KiB
Bash
Executable File
102 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# export http_proxy=http://192.168.1.1:3128
|
|
# export ftp_proxy=http://192.168.1.1:3128
|
|
|
|
# add git user
|
|
adduser --disabled-login --gecos 'GitLab' git
|
|
|
|
# install gitlab-shell
|
|
sudo -u git -H mkdir -p /home/git/gitlab-shell
|
|
wget "https://github.com/gitlabhq/gitlab-shell/archive/v1.7.1.tar.gz" -O - | tar -zxf - --strip=1 -C /home/git/gitlab-shell/
|
|
chown -R git:git /home/git/gitlab-shell/
|
|
|
|
cd /home/git/gitlab-shell
|
|
sudo -u git -H cp -a config.yml.example config.yml
|
|
sudo -u git -H ./bin/install
|
|
|
|
# install gitlab
|
|
sudo -u git -H mkdir -p /home/git/gitlab
|
|
wget "https://github.com/gitlabhq/gitlabhq/archive/v6.1.0.tar.gz" -O - | tar -zxf - --strip=1 -C /home/git/gitlab/
|
|
chown -R git:git /home/git/gitlab/
|
|
|
|
cd /home/git/gitlab
|
|
|
|
# copy default configurations
|
|
sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
|
|
sudo -u git -H cp config/resque.yml.example config/resque.yml
|
|
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
|
|
|
|
# create required tmp and log directories
|
|
sudo -u git -H mkdir -p tmp/pids/ tmp/sockets/
|
|
chmod -R u+rwX log tmp
|
|
|
|
# create uploads directory
|
|
sudo -u git -H mkdir -p public/uploads
|
|
chmod -R u+rwX public/uploads
|
|
|
|
# create satellites directory
|
|
sudo -u git -H mkdir -p /home/git/gitlab-satellites
|
|
|
|
# install gems required by gitlab
|
|
gem install charlock_holmes --version '0.6.9.4'
|
|
sudo -u git -H bundle install --deployment --without development test postgres aws
|
|
|
|
# add database.yml template
|
|
sudo -u git -H cat > config/database.yml <<EOF
|
|
production:
|
|
adapter: mysql2
|
|
encoding: utf8
|
|
reconnect: false
|
|
database: {{DB_NAME}}
|
|
host: {{DB_HOST}}
|
|
username: {{DB_USER}}
|
|
password: {{DB_PASS}}
|
|
pool: {{DB_POOL}}
|
|
EOF
|
|
chmod o-rwx config/database.yml
|
|
|
|
sudo -u git -H cat > config/sidekiq.yml <<EOF
|
|
:concurrency: {{SIDEKIQ_CONCURRENCY}}
|
|
EOF
|
|
chmod o-rwx config/sidekiq.yml
|
|
|
|
# make sure everything in /home/git is owned by the git user
|
|
chown -R git:git /home/git/
|
|
|
|
# copy nginx configuration
|
|
cp lib/support/init.d/gitlab /etc/init.d/gitlab
|
|
sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab
|
|
sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
|
|
|
|
# create the /var/run/sshd directory (required for sshd to start)
|
|
mkdir -p /var/run/sshd
|
|
|
|
# configure nginx
|
|
sed 's/YOUR_SERVER_FQDN/localhost/' -i /etc/nginx/sites-available/gitlab
|
|
echo "daemon off;" >> /etc/nginx/nginx.conf
|
|
cat > /etc/supervisor/conf.d/nginx.conf <<EOF
|
|
[program:nginx]
|
|
priority=20
|
|
directory=/tmp
|
|
command=/usr/sbin/nginx
|
|
user=root
|
|
autostart=true
|
|
autorestart=true
|
|
stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
|
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
|
EOF
|
|
|
|
#
|
|
cat > /etc/supervisor/conf.d/openssh-server.conf <<EOF
|
|
[program:openssh-server]
|
|
priority=20
|
|
directory=/tmp
|
|
command=/usr/sbin/sshd
|
|
user=root
|
|
autostart=true
|
|
autorestart=true
|
|
stdout_logfile=/var/log/supervisor/%(program_name)s.log
|
|
stderr_logfile=/var/log/supervisor/%(program_name)s.log
|
|
EOF
|