Switch from git to gogs to maintain consistency
This commit is contained in:
parent
795f216d2b
commit
989c48f88b
|
@ -34,8 +34,8 @@ SHOW_ON_ABOUT=1
|
|||
GOGS_USERNAME='gogs'
|
||||
GOGS_VERSION='0.11.29'
|
||||
|
||||
GIT_DOMAIN_NAME=
|
||||
GIT_CODE=
|
||||
GOGS_DOMAIN_NAME=
|
||||
GOGS_CODE=
|
||||
GIT_ONION_PORT=8090
|
||||
GIT_ADMIN_PASSWORD=
|
||||
GOGS_BIN=
|
||||
|
@ -47,9 +47,8 @@ GOGS_MOBILE_APP_URL=
|
|||
|
||||
gogs_variables=(ONION_ONLY
|
||||
GIT_ADMIN_PASSWORD
|
||||
GIT_DOMAIN_NAME
|
||||
GIT_CODE
|
||||
GIT_ONION_PORT
|
||||
GOGS_DOMAIN_NAME
|
||||
GOGS_CODE
|
||||
MY_USERNAME
|
||||
DDNS_PROVIDER
|
||||
ARCHITECTURE)
|
||||
|
@ -69,8 +68,8 @@ function change_password_gogs {
|
|||
|
||||
function install_interactive_gogs {
|
||||
if [[ $ONION_ONLY != "no" ]]; then
|
||||
GIT_DOMAIN_NAME='gogs.local'
|
||||
write_config_param "GIT_DOMAIN_NAME" "$GIT_DOMAIN_NAME"
|
||||
GOGS_DOMAIN_NAME='gogs.local'
|
||||
write_config_param "GOGS_DOMAIN_NAME" "$GOGS_DOMAIN_NAME"
|
||||
else
|
||||
function_check interactive_site_details
|
||||
interactive_site_details git
|
||||
|
@ -160,8 +159,8 @@ function upgrade_gogs {
|
|||
# Change port number if necessary
|
||||
if ! grep -q "HTTP_PORT = ${GOGS_PORT}" "${GOGS_CONFIG_FILE}"; then
|
||||
sed -i "s|HTTP_PORT =.*|HTTP_PORT = ${GOGS_PORT}|g" "${GOGS_CONFIG_FILE}"
|
||||
read_config_param GIT_DOMAIN_NAME
|
||||
sed -i "s|proxy_pass .*|proxy_pass http://localhost:${GOGS_PORT};|g" "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
read_config_param GOGS_DOMAIN_NAME
|
||||
sed -i "s|proxy_pass .*|proxy_pass http://localhost:${GOGS_PORT};|g" "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
systemctl restart gogs
|
||||
systemctl restart nginx
|
||||
fi
|
||||
|
@ -272,7 +271,7 @@ function restore_local_gogs {
|
|||
return
|
||||
fi
|
||||
|
||||
if [ ${#GIT_DOMAIN_NAME} -gt 2 ]; then
|
||||
if [ ${#GOGS_DOMAIN_NAME} -gt 2 ]; then
|
||||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
||||
|
@ -280,7 +279,7 @@ function restore_local_gogs {
|
|||
GOGS_CONFIG_FILE="${GOGS_CONFIG_PATH}/app.ini"
|
||||
|
||||
function_check restore_database
|
||||
restore_database gogs "${GIT_DOMAIN_NAME}"
|
||||
restore_database gogs "${GOGS_DOMAIN_NAME}"
|
||||
temp_restore_dir=/root/tempgogs
|
||||
if [ -d "${USB_MOUNT}/backup/gogs" ]; then
|
||||
echo $"Restoring Gogs settings"
|
||||
|
@ -354,7 +353,7 @@ function restore_local_gogs {
|
|||
function backup_remote_gogs {
|
||||
if [ -d /home/$GOGS_USERNAME ]; then
|
||||
function_check suspend_site
|
||||
suspend_site ${GIT_DOMAIN_NAME}
|
||||
suspend_site ${GOGS_DOMAIN_NAME}
|
||||
|
||||
function_check backup_database_to_friend
|
||||
backup_database_to_friend gogs
|
||||
|
@ -383,7 +382,7 @@ function backup_remote_gogs {
|
|||
|
||||
function restore_remote_gogs {
|
||||
if grep -q "gogs domain" "$COMPLETION_FILE"; then
|
||||
GIT_DOMAIN_NAME=$(get_completion_param "gogs domain")
|
||||
GOGS_DOMAIN_NAME=$(get_completion_param "gogs domain")
|
||||
|
||||
function_check gogs_create_database
|
||||
gogs_create_database
|
||||
|
@ -392,7 +391,7 @@ function restore_remote_gogs {
|
|||
GOGS_CONFIG_FILE=${GOGS_CONFIG_PATH}/app.ini
|
||||
|
||||
function_check restore_database_from_friend
|
||||
restore_database_from_friend gogs "${GIT_DOMAIN_NAME}"
|
||||
restore_database_from_friend gogs "${GOGS_DOMAIN_NAME}"
|
||||
if [ -d "${SERVER_DIRECTORY}/backup/gogs" ]; then
|
||||
if [ ! -d $GOGS_CONFIG_PATH ]; then
|
||||
mkdir -p $GOGS_CONFIG_PATH
|
||||
|
@ -449,19 +448,19 @@ function restore_remote_gogs {
|
|||
}
|
||||
|
||||
function remove_gogs {
|
||||
if [ ${#GIT_DOMAIN_NAME} -eq 0 ]; then
|
||||
if [ ${#GOGS_DOMAIN_NAME} -eq 0 ]; then
|
||||
return
|
||||
fi
|
||||
systemctl stop gogs
|
||||
systemctl disable gogs
|
||||
|
||||
nginx_dissite "${GIT_DOMAIN_NAME}"
|
||||
remove_certs "${GIT_DOMAIN_NAME}"
|
||||
if [ -d "/var/www/${GIT_DOMAIN_NAME}" ]; then
|
||||
rm -rf "/var/www/${GIT_DOMAIN_NAME}"
|
||||
nginx_dissite "${GOGS_DOMAIN_NAME}"
|
||||
remove_certs "${GOGS_DOMAIN_NAME}"
|
||||
if [ -d "/var/www/${GOGS_DOMAIN_NAME}" ]; then
|
||||
rm -rf "/var/www/${GOGS_DOMAIN_NAME}"
|
||||
fi
|
||||
if [ -f "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}" ]; then
|
||||
rm "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
if [ -f "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}" ]; then
|
||||
rm "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
fi
|
||||
function_check drop_database
|
||||
drop_database gogs
|
||||
|
@ -477,11 +476,11 @@ function remove_gogs {
|
|||
userdel -r gogs
|
||||
|
||||
function_check remove_ddns_domain
|
||||
remove_ddns_domain "$GIT_DOMAIN_NAME"
|
||||
remove_ddns_domain "$GOGS_DOMAIN_NAME"
|
||||
}
|
||||
|
||||
function install_gogs {
|
||||
if [ ! "$GIT_DOMAIN_NAME" ]; then
|
||||
if [ ! "$GOGS_DOMAIN_NAME" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
@ -584,33 +583,33 @@ function install_gogs {
|
|||
systemctl daemon-reload
|
||||
systemctl start gogs
|
||||
|
||||
if [ ! -d "/var/www/${GIT_DOMAIN_NAME}" ]; then
|
||||
mkdir "/var/www/${GIT_DOMAIN_NAME}"
|
||||
if [ ! -d "/var/www/${GOGS_DOMAIN_NAME}" ]; then
|
||||
mkdir "/var/www/${GOGS_DOMAIN_NAME}"
|
||||
fi
|
||||
if [ -d "/var/www/${GIT_DOMAIN_NAME}/htdocs" ]; then
|
||||
rm -rf "/var/www/${GIT_DOMAIN_NAME}/htdocs"
|
||||
if [ -d "/var/www/${GOGS_DOMAIN_NAME}/htdocs" ]; then
|
||||
rm -rf "/var/www/${GOGS_DOMAIN_NAME}/htdocs"
|
||||
fi
|
||||
|
||||
if [[ "${ONION_ONLY}" == "no" ]]; then
|
||||
function_check nginx_http_redirect
|
||||
nginx_http_redirect "${GIT_DOMAIN_NAME}"
|
||||
nginx_http_redirect "${GOGS_DOMAIN_NAME}"
|
||||
{ echo 'server {';
|
||||
echo ' listen 443 ssl;';
|
||||
echo ' #listen [::]:443 ssl;';
|
||||
echo " root /var/www/${GIT_DOMAIN_NAME}/htdocs;";
|
||||
echo " server_name ${GIT_DOMAIN_NAME};";
|
||||
echo " root /var/www/${GOGS_DOMAIN_NAME}/htdocs;";
|
||||
echo " server_name ${GOGS_DOMAIN_NAME};";
|
||||
echo ' access_log /dev/null;';
|
||||
echo " error_log /dev/null;";
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
function_check nginx_ssl
|
||||
nginx_ssl "${GIT_DOMAIN_NAME}"
|
||||
nginx_ssl "${GOGS_DOMAIN_NAME}"
|
||||
function_check nginx_security_options
|
||||
nginx_security_options "${GIT_DOMAIN_NAME}"
|
||||
nginx_security_options "${GOGS_DOMAIN_NAME}"
|
||||
{ echo ' add_header Strict-Transport-Security max-age=0;';
|
||||
echo '';
|
||||
echo ' location / {'; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo ' location / {'; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
function_check nginx_limits
|
||||
nginx_limits "${GIT_DOMAIN_NAME}" '10G'
|
||||
nginx_limits "${GOGS_DOMAIN_NAME}" '10G'
|
||||
{ echo " proxy_pass http://localhost:${GOGS_PORT};";
|
||||
echo ' }';
|
||||
echo '';
|
||||
|
@ -625,24 +624,24 @@ function install_gogs {
|
|||
echo ' access_log /dev/null;';
|
||||
echo ' }';
|
||||
echo '}';
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
else
|
||||
echo -n '' > "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo -n '' > "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
fi
|
||||
{ echo 'server {';
|
||||
echo " listen 127.0.0.1:${GIT_ONION_PORT} default_server;";
|
||||
echo " root /var/www/$GIT_DOMAIN_NAME/htdocs;";
|
||||
echo " server_name $GIT_DOMAIN_NAME;";
|
||||
echo " root /var/www/$GOGS_DOMAIN_NAME/htdocs;";
|
||||
echo " server_name $GOGS_DOMAIN_NAME;";
|
||||
echo ' access_log /dev/null;';
|
||||
echo " error_log /dev/null;";
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo ''; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
function_check nginx_security_options
|
||||
nginx_security_options "${GIT_DOMAIN_NAME}"
|
||||
nginx_security_options "${GOGS_DOMAIN_NAME}"
|
||||
{ echo ' add_header Strict-Transport-Security max-age=0;';
|
||||
echo '';
|
||||
echo ' location / {'; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo ' location / {'; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
function_check nginx_limits
|
||||
nginx_limits "${GIT_DOMAIN_NAME}" '10G'
|
||||
nginx_limits "${GOGS_DOMAIN_NAME}" '10G'
|
||||
{ echo " proxy_pass http://localhost:${GOGS_PORT};";
|
||||
echo ' }';
|
||||
echo '';
|
||||
|
@ -656,15 +655,15 @@ function install_gogs {
|
|||
echo ' log_not_found off;';
|
||||
echo ' access_log /dev/null;';
|
||||
echo ' }';
|
||||
echo '}'; } >> "/etc/nginx/sites-available/${GIT_DOMAIN_NAME}"
|
||||
echo '}'; } >> "/etc/nginx/sites-available/${GOGS_DOMAIN_NAME}"
|
||||
|
||||
function_check configure_php
|
||||
configure_php
|
||||
|
||||
function_check create_site_certificate
|
||||
create_site_certificate "${GIT_DOMAIN_NAME}" 'yes'
|
||||
create_site_certificate "${GOGS_DOMAIN_NAME}" 'yes'
|
||||
|
||||
nginx_ensite "${GIT_DOMAIN_NAME}"
|
||||
nginx_ensite "${GOGS_DOMAIN_NAME}"
|
||||
|
||||
if [ ! -d /var/lib/tor ]; then
|
||||
echo $'No Tor installation found. Gogs onion site cannot be configured.'
|
||||
|
@ -689,11 +688,11 @@ function install_gogs {
|
|||
systemctl restart php7.0-fpm
|
||||
systemctl restart nginx
|
||||
|
||||
set_completion_param "gogs domain" "$GIT_DOMAIN_NAME"
|
||||
set_completion_param "gogs domain" "$GOGS_DOMAIN_NAME"
|
||||
set_completion_param "gogs onion domain" "$GIT_ONION_HOSTNAME"
|
||||
|
||||
function_check add_ddns_domain
|
||||
add_ddns_domain "${GIT_DOMAIN_NAME}"
|
||||
add_ddns_domain "${GOGS_DOMAIN_NAME}"
|
||||
|
||||
# obtain the secret key
|
||||
GOGS_SECRET_KEY="$(create_password "${MINIMUM_PASSWORD_LENGTH}")"
|
||||
|
@ -722,17 +721,17 @@ function install_gogs {
|
|||
echo '';
|
||||
echo '[server]'; } >> ${GOGS_CONFIG_FILE}
|
||||
if [[ ${ONION_ONLY} == 'no' ]]; then
|
||||
echo "DOMAIN = ${GIT_DOMAIN_NAME}" >> ${GOGS_CONFIG_FILE}
|
||||
echo "ROOT_URL = https://$GIT_DOMAIN_NAME/" >> ${GOGS_CONFIG_FILE}
|
||||
echo "DOMAIN = ${GOGS_DOMAIN_NAME}" >> ${GOGS_CONFIG_FILE}
|
||||
echo "ROOT_URL = https://$GOGS_DOMAIN_NAME/" >> ${GOGS_CONFIG_FILE}
|
||||
else
|
||||
echo "DOMAIN = ${GIT_ONION_HOSTNAME}" >> ${GOGS_CONFIG_FILE}
|
||||
echo "ROOT_URL = http://$GIT_DOMAIN_NAME/" >> ${GOGS_CONFIG_FILE}
|
||||
echo "ROOT_URL = http://$GOGS_DOMAIN_NAME/" >> ${GOGS_CONFIG_FILE}
|
||||
fi
|
||||
{ echo "HTTP_PORT = ${GOGS_PORT}";
|
||||
echo "SSH_PORT = $SSH_PORT";
|
||||
echo 'SSH_DOMAIN = %(DOMAIN)s';
|
||||
echo "CERT_FILE = /etc/ssl/certs/${GIT_DOMAIN_NAME}.pem";
|
||||
echo "KEY_FILE = /etc/ssl/private/${GIT_DOMAIN_NAME}.key";
|
||||
echo "CERT_FILE = /etc/ssl/certs/${GOGS_DOMAIN_NAME}.pem";
|
||||
echo "KEY_FILE = /etc/ssl/private/${GOGS_DOMAIN_NAME}.key";
|
||||
echo 'DISABLE_ROUTER_LOG = true';
|
||||
echo '';
|
||||
echo '[session]';
|
||||
|
@ -762,9 +761,9 @@ function install_gogs {
|
|||
systemctl restart gogs
|
||||
|
||||
if ! grep -q "gogs domain:" "${COMPLETION_FILE}"; then
|
||||
echo "gogs domain:${GIT_DOMAIN_NAME}" >> "${COMPLETION_FILE}"
|
||||
echo "gogs domain:${GOGS_DOMAIN_NAME}" >> "${COMPLETION_FILE}"
|
||||
else
|
||||
sed -i "s|gogs domain.*|gogs domain:${GIT_DOMAIN_NAME}|g" "${COMPLETION_FILE}"
|
||||
sed -i "s|gogs domain.*|gogs domain:${GOGS_DOMAIN_NAME}|g" "${COMPLETION_FILE}"
|
||||
fi
|
||||
|
||||
function_check configure_firewall_for_git
|
||||
|
|
|
@ -74,8 +74,8 @@ GNUSOCIAL_DOMAIN_NAME=
|
|||
GNUSOCIAL_CODE=
|
||||
GNUSOCIAL_WELCOME_MESSAGE=$"<h1>Welcome to \$GNUSOCIAL_DOMAIN_NAME a federated social network</h1><p>Another $PROJECT_NAME site</p>"
|
||||
GNUSOCIAL_BACKGROUND_IMAGE_URL=
|
||||
GIT_DOMAIN_NAME=
|
||||
GIT_CODE=
|
||||
GOGS_DOMAIN_NAME=
|
||||
GOGS_CODE=
|
||||
USB_DRIVE=/dev/sdb1
|
||||
HWRNG_TYPE=
|
||||
ENABLE_SOCIAL_KEY_MANAGEMENT=
|
||||
|
|
|
@ -211,7 +211,7 @@ function set_default_onion_domains {
|
|||
BLUDIT_DOMAIN_NAME='bludit.local'
|
||||
DOKUWIKI_DOMAIN_NAME='dokuwiki.local'
|
||||
DEFAULT_DOMAIN_NAME="${LOCAL_NAME}.local"
|
||||
GIT_DOMAIN_NAME='gogs.local'
|
||||
GOGS_DOMAIN_NAME='gogs.local'
|
||||
}
|
||||
|
||||
function create_avahi_onion_domains {
|
||||
|
@ -229,7 +229,7 @@ function create_avahi_onion_domains {
|
|||
function_check create_avahi_service
|
||||
create_avahi_service blog http tcp "$HTMLY_ONION_PORT"
|
||||
fi
|
||||
if [ $GIT_DOMAIN_NAME ]; then
|
||||
if [ $GOGS_DOMAIN_NAME ]; then
|
||||
function_check create_avahi_service
|
||||
create_avahi_service git http tcp "$GIT_ONION_PORT"
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue