Moved commands to docker-compose and created base directories for each service
This commit is contained in:
parent
859d1e7920
commit
9f78abfd9d
12 changed files with 130 additions and 0 deletions
34
gitlab/docker-compose.yml
Normal file
34
gitlab/docker-compose.yml
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
version: '3.6'
|
||||
services:
|
||||
web:
|
||||
image: 'gitlab/gitlab-ce:latest'
|
||||
hostname: ${GITLAB_ADDRESS}
|
||||
container_name: gitlab
|
||||
environment:
|
||||
TZ: 'America/Los_Angeles'
|
||||
GITLAB_OMNIBUS_CONFIG: |
|
||||
external_url ${GITLAB_ADDRESS}
|
||||
gitlab_rails['lfs_enabled'] = true
|
||||
gitlab_rails['gitlab_shell_ssh_port'] = 2222
|
||||
# gitlab_rails['gitlab_email_enabled'] = true
|
||||
# gitlab_rails['gitlab_email_from'] = 'help@adamhome.dev'
|
||||
# gitlab_rails['gitlab_email_display_name'] = 'GitLab Help'
|
||||
# gitlab_rails['gitlab_email_reply_to'] = 'help@adamhome.dev'
|
||||
# gitlab_rails['smtp_enable'] = true
|
||||
# gitlab_rails['smtp_address'] = 'smtp.gmail.com'
|
||||
# gitlab_rails['smtp_port'] = 587
|
||||
# gitlab_rails['smtp_user_name'] = ''
|
||||
# gitlab_rails['smtp_password'] = ''
|
||||
# gitlab_rails['smtp_domain'] = 'smtp.gmail.com'
|
||||
# gitlab_rails['smtp_authentication'] = 'login'
|
||||
# gitlab_rails['smtp_enable_starttls_auto'] = true
|
||||
ports:
|
||||
- ${GITLAB_EXTERN_HTTPS}':443'
|
||||
- ${GITLAB_EXTERN_HTTP}':80'
|
||||
- ${GITLAB_EXTERN_SSH}':22'
|
||||
volumes:
|
||||
- $GITLAB_HOME/config:/etc/gitlab
|
||||
- $GITLAB_HOME/logs:/var/log/gitlab
|
||||
- $GITLAB_HOME/data:/var/opt/gitlab
|
||||
shm_size: '256m'
|
||||
restart: always
|
||||
60
gitlab/gitlab_install.sh
Executable file
60
gitlab/gitlab_install.sh
Executable file
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
## Define admin user account
|
||||
if [ -z "$ADMIN_ACCOUNT"]
|
||||
then
|
||||
ADMIN_ACCOUNT=root
|
||||
fi
|
||||
su - ${ADMIN_ACCOUNT}
|
||||
|
||||
## Define bulk storage location
|
||||
if [ -z "$ZFS_DIR" ]
|
||||
then
|
||||
ZFS_DIR=/data
|
||||
fi
|
||||
|
||||
echo "Installing GitLab ..."
|
||||
GITLAB_HOME=${ZFS_DIR}/gitlab
|
||||
|
||||
GITLAB_ADDRESS=gitlab.adamhome.dev
|
||||
GITLAB_EXTERN_HTTPS=14443
|
||||
GITLAB_EXTERN_HTTP=14080
|
||||
GITLAB_EXTERN_SSH=22
|
||||
|
||||
if [ "${GITLAB_EXTERN_SSH}" -eq 22 ]
|
||||
then
|
||||
awk '{sub("#PORT=22","PORT=22")} {print}' /etc/ssh/sshd_config > /tmp/temp.txt && mv /tmp/temp.txt /etc/ssh/sshd_config
|
||||
awk '{sub("# PORT=22","PORT=22")} {print}' /etc/ssh/sshd_config > /tmp/temp.txt && mv /tmp/temp.txt /etc/ssh/sshd_config
|
||||
awk -v port=2222 '{sub("PORT=22","PORT="2222)} {print}' /etc/ssh/sshd_config > /tmp/temp.txt && mv /tmp/temp.txt /etc/ssh/sshd_config
|
||||
sudo systemctl reload sshd
|
||||
fi
|
||||
|
||||
sudo docker run --detach \
|
||||
--hostname ${GITLAB_ADDRESS} \
|
||||
--publish ${GITLAB_EXTERN_HTTPS}:443 \
|
||||
--publish ${GITLAB_EXTERN_HTTP}:80 \
|
||||
--publish ${GITLAB_EXTERN_SSH}:22 \
|
||||
--name gitlab \
|
||||
--restart always \
|
||||
--volume ${GITLAB_HOME}/config:/etc/gitlab \
|
||||
--volume ${GITLAB_HOME}/logs:/var/log/gitlab \
|
||||
--volume ${GITLAB_HOME}/data:/var/opt/gitlab \
|
||||
--shm-size 512m \
|
||||
gitlab/gitlab-ce:latest
|
||||
|
||||
## Uncomment if you want to monitor boot-up
|
||||
# sudo docker logs -f gitlab
|
||||
|
||||
# sudo docker exec -it gitlab /bin/bash
|
||||
# edit /etc/gitlab/gitlab.rb so that gitlab_rails['gitlab_shell_ssh_port'] = ${GITLAB_EXTERN_SSH}
|
||||
# while still in gitlab env, run gitlab-ctl reconfigure
|
||||
|
||||
sudo docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password
|
||||
|
||||
echo "Successfully installed GitLab"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue