Commit f3fec295 authored by Vladimir Bashkirtsev's avatar Vladimir Bashkirtsev

Added CWMP configuration of GitLab

parent a94bfe08
all: database-config resque-yml nginx-conf logrotate-conf
all: database-config resque-yml nginx-conf logrotate-conf gitlab-service-override gitlab-config
rm /etc/passwd
mv -v /data/etc/passwd /etc/passwd
rm /etc/group
......@@ -115,6 +115,11 @@ all: database-config resque-yml nginx-conf logrotate-conf
sed -e "s/YOUR_SERVER_FQDN/_/" -i /etc/nginx/gitlab.conf
install -v -m755 /srv/gitlab/lib/support/init.d/gitlab /etc/init.d/gitlab
sed -e "s/redis-server/redis/" -i /etc/init.d/gitlab
install -v -m755 -d /lib/systemd/system/gitlab.service.d
install -v -Dm755 gitlab-init /usr/sbin/gitlab-init
@echo "$$GITLAB_SERVICE_OVERRIDE" > /lib/systemd/system/gitlab.service.d/override.conf
@echo "$$GITLAB_CONFIG" > /etc/config/gitlab
install -v -Dm755 gitlab /usr/share/easycwmp/functions/gitlab
install -v -m644 /srv/gitlab/lib/support/init.d/gitlab.default.example /etc/default/gitlab
sed -e "s/\/home\/\(\$$app_user\|git\)/\/srv/" -i /etc/default/gitlab
sed -e "s/\$$app_root\/tmp\/pids/\/run\/gitlab/" -i /etc/default/gitlab
......@@ -146,6 +151,8 @@ all: database-config resque-yml nginx-conf logrotate-conf
mv -v /srv/gitlab/builds /var/lib/gitlab/builds
ln -sv /var/lib/gitlab/builds /srv/gitlab/builds
mv -v /srv/gitlab/config/gitlab.yml /var/lib/gitlab/config/gitlab.yml
ln -sv /var/lib/gitlab/config/gitlab.yml /srv/gitlab/config/gitlab.yml
mv -v /srv/gitlab/config/secrets.yml /var/lib/gitlab/config/secrets.yml
ln -sv /var/lib/gitlab/config/secrets.yml /srv/gitlab/config/secrets.yml
rm -rf /srv/gitlab/log
......@@ -215,3 +222,22 @@ define LOGROTATE_CONF
}
endef
export LOGROTATE_CONF
gitlab-service-override:
define GITLAB_SERVICE_OVERRIDE
[Service]
TimeoutSec=300
ExecStartPre=/usr/sbin/gitlab-init
endef
export GITLAB_SERVICE_OVERRIDE
gitlab-config:
define GITLAB_CONFIG
config gitlab 'settings'
option host ''
option ssh_host ''
option email_from ''
option email_reply_to ''
endef
export GITLAB_CONFIG
#!/bin/sh
#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
# $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
# Default of $type = string
#############################
# Entry point functuons #
#############################
prefix_list="$prefix_list $DMROOT.GitLab."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_GitLab"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform entry_execute_method_root_GitLab"
entry_execute_method_root_GitLab() {
case "$1" in ""|"$DMROOT."|"$DMROOT.GitLab."*)
common_execute_method_obj "$DMROOT.GitLab." "0"
common_execute_method_param "$DMROOT.GitLab.Host" "1" "gitlab_get_host" "gitlab_set_host"
common_execute_method_param "$DMROOT.GitLab.SSHHost" "1" "gitlab_get_ssh_host" "gitlab_set_ssh_host"
common_execute_method_param "$DMROOT.GitLab.EmailFrom" "1" "gitlab_get_email_from" "gitlab_set_email_from"
common_execute_method_param "$DMROOT.GitLab.EmailReplyTo" "1" "gitlab_get_email_reply_to" "gitlab_set_email_reply_to"
return 0;
;;
esac
return $E_INVALID_PARAMETER_NAME;
}
#######################################
# Data model parameters functions #
#######################################
gitlab_get_host() {
echo `$UCI_GET gitlab.settings.host`
}
gitlab_set_host() {
local url=`$UCI_GET gitlab.settings.host`
if [ "$url" != "$1" ]; then
$UCI_SET gitlab.settings.host="$1"
$UCI_COMMIT
systemctl stop gitlab
systemctl start gitlab
fi
}
gitlab_get_ssh_host() {
echo `$UCI_GET gitlab.settings.ssh_host`
}
gitlab_set_ssh_host() {
local url=`$UCI_GET gitlab.settings.ssh_host`
if [ "$url" != "$1" ]; then
$UCI_SET gitlab.settings.ssh_host="$1"
$UCI_COMMIT
systemctl stop gitlab
systemctl start gitlab
fi
}
gitlab_get_email_from() {
echo `$UCI_GET gitlab.settings.email_from`
}
gitlab_set_email_from() {
local address=`$UCI_GET gitlab.settings.email_from`
if [ "$address" != "$1" ]; then
$UCI_SET gitlab.settings.email_from="$1"
$UCI_COMMIT
systemctl stop gitlab
systemctl start gitlab
fi
}
gitlab_get_email_reply_to() {
echo `$UCI_GET gitlab.settings.email_reply_to`
}
gitlab_set_email_reply_to() {
local address=`$UCI_GET gitlab.settings.email_reply_to`
if [ "$address" != "$1" ]; then
$UCI_SET gitlab.settings.email_reply_to="$1"
$UCI_COMMIT
systemctl stop gitlab
systemctl start gitlab
fi
}
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment