Compare commits

...

32 Commits

Author SHA1 Message Date
barremian
d8c38c40c8 lxc-forgejo: Enable --yes for 'apt-get' cleanup commands 2024-05-30 05:57:55 +02:00
barremian
2a4097d663 lxc-forgejo: Enable --quiet for 'systemctl enable' 2024-05-30 05:56:58 +02:00
barremian
710f92871a lxc-forgejo: Remove info written to ~/forgejo.creds 2024-05-30 05:54:54 +02:00
barremian
453d6f566a lxc-forgejo: Remove commented option from service 2024-05-29 16:34:02 +02:00
barremian
52a66dd6f0 lxc-forgejo: Remove database choice 2024-05-29 16:33:12 +02:00
barremian
d528ceb75a lxc-forgejo: Replace commands split by && with individual commands 2024-05-29 16:09:41 +02:00
barremian
5aa04f46e0 lxc-forgejo: Revert script paths back to tteck/main 2024-05-29 12:32:27 +02:00
barremian
cb05e65788 lxc-forgejo: Replace 127.0.0.1 with localhost 2024-05-29 12:28:43 +02:00
barremian
92c971566f lxc-forgejo: Silently install MariaDB if MySQL is preferred by the user 2024-05-29 12:14:07 +02:00
barremian
fff3a6864e lxc-forgejo: Use ALTER USER to set root user password for MySQL and MariaDB 2024-05-29 11:35:42 +02:00
barremian
93c62470b3 lxc-forgejo: Expand unbound variables to empty strings to suppress 'unbound variable' errors 2024-05-29 10:48:44 +02:00
barremian
1775053616 lxc-forgejo: Adjust ASCII art 2024-05-29 10:42:49 +02:00
barremian
9157c616ac lxc-forgejo: Offer adminer installation only if SQLite isn't used 2024-05-29 10:42:33 +02:00
barremian
a965e77f7e lxc-forgejo: Replace 127.0.0.1 with localhost 2024-05-29 10:41:44 +02:00
barremian
c527ec90ef lxc-forgejo: Expand unbound variables to empty strings to suppress 'unbound variable' errors 2024-05-29 10:41:17 +02:00
barremian
75063708ed lxc-forgejo: Remove redundant 'DB will be used' message 2024-05-29 08:54:31 +02:00
barremian
62c2da36cc lxc-forgejo: Reintroduce database specific msg outputs 2024-05-29 00:59:11 +02:00
barremian
a2dde479c5 lxc-forgejo: Update 'if' DB_CHOICE conditions to account for whiptail -> select change 2024-05-29 00:49:15 +02:00
barremian
2f1b9e27b8 lxc-forgejo: Move database choice if statements with switch-case inside the select command 2024-05-29 00:37:56 +02:00
barremian
ddafd1f871 lxc-forgejo: Move 'read' command above msg_info function call and remove DB specific messages 2024-05-29 00:22:53 +02:00
barremian
5092297a92 lxc-forgejo: Replace concluding msg_info with msg_ok and remove unnecessary service restart messages for database setups 2024-05-29 00:13:21 +02:00
barremian
f6ca207f58 lxc-forgejo: Prefix 'adduser' with STD 2024-05-29 00:04:27 +02:00
barremian
6b222b9ab8 lxc-forgejo: Replace 'whiptail' for database selection with 'select' 2024-05-28 23:54:55 +02:00
barremian
310cc3ebe6 lxc-forgejo: Add --separate-output to attempt to hide Whiptail after user input during installation 2024-05-28 22:57:49 +02:00
barremian
453ee8dcce lxc-forgejo: Write relevant information to ~/forgejo.creds:
- Forgejo GIT User
- Forgejo data directory
- Database type and host
2024-05-28 22:56:56 +02:00
barremian
8d141b4c06 lxc-forgejo: Add -y to apt-get install commands 2024-05-28 21:47:02 +02:00
barremian
ca2e47dfc5 lxc-forgejo: Fix var name typo 2024-05-28 21:16:28 +02:00
barremian
c91484dfb8 lxc-forgejo: Add -s to curl commands 2024-05-28 21:15:59 +02:00
barremian
099815350e lxc-forgejo: Replace tteck/*-install.sh with barremian/*-install.sh for testing 2024-05-28 21:09:41 +02:00
barremian
258e7535e6 lxc-forgejo: Replace main branch with feature branch in build.func path 2024-05-28 20:54:07 +02:00
barremian
04f60eee38 lxc-forgejo: Replace tteck/build.func to barremian/build.func for testing 2024-05-28 20:50:22 +02:00
barremian
4b6a6b9574 Add lxc-forgejo: initial implementation 2024-05-28 20:48:53 +02:00
2 changed files with 158 additions and 0 deletions

89
ct/forgejo.sh Normal file
View File

@@ -0,0 +1,89 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
______ _
/ ____/___ _________ ___ (_)___
/ /_ / __ \/ ___/ __ `/ _ \ / / __ \
/ __/ / /_/ / / / /_/ / __/ / / /_/ /
/_/ \____/_/ \__, /\___/_/ /\____/
/____/ /___/
EOF
}
header_info
echo -e "Loading..."
APP="Forgejo"
var_disk="10"
var_cpu="2"
var_ram="2048"
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
header_info
if [[ ! -d /opt/forgejo ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Stopping ${APP}"
systemctl stop forgejo
msg_ok "Stopped ${APP}"
msg_info "Updating ${APP}"
RELEASE=$(curl -s https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//')
wget -qO forgejo-$RELEASE-linux-amd64 "https://codeberg.org/forgejo/forgejo/releases/download/v${RELEASE}/forgejo-${RELEASE}-linux-amd64"
rm -rf /opt/forgejo/*
cp -r forgejo-$RELEASE-linux-amd64 /opt/forgejo/forgejo-$RELEASE-linux-amd64
chmod +x /opt/forgejo/forgejo-$RELEASE-linux-amd64
ln -sf /opt/forgejo/forgejo-$RELEASE-linux-amd64 /usr/local/bin/forgejo
msg_ok "Updated ${APP}"
msg_info "Cleaning"
rm -rf forgejo-$RELEASE-linux-amd64
msg_ok "Cleaned"
msg_info "Starting ${APP}"
systemctl start forgejo
msg_ok "Started ${APP}"
msg_ok "Updated Successfully"
exit
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${APP} should be reachable by going to the following URL.
${BL}http://${IP}:3000${CL} \n"

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
$STD apt-get install -y git
$STD apt-get install -y git-lfs
msg_ok "Installed Dependencies"
msg_info "Installing Forgejo"
mkdir -p /opt/forgejo
RELEASE=$(curl -s https://codeberg.org/api/v1/repos/forgejo/forgejo/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//')
wget -qO /opt/forgejo/forgejo-$RELEASE-linux-amd64 "https://codeberg.org/forgejo/forgejo/releases/download/v${RELEASE}/forgejo-${RELEASE}-linux-amd64"
chmod +x /opt/forgejo/forgejo-$RELEASE-linux-amd64
ln -sf /opt/forgejo/forgejo-$RELEASE-linux-amd64 /usr/local/bin/forgejo
msg_ok "Installed Forgejo"
msg_info "Setting up Forgejo"
$STD adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
mkdir /var/lib/forgejo
chown git:git /var/lib/forgejo
chmod 750 /var/lib/forgejo
mkdir /etc/forgejo
chown root:git /etc/forgejo
chmod 770 /etc/forgejo
msg_ok "Setup Forgejo"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/forgejo.service
[Unit]
Description=Forgejo
After=syslog.target
After=network.target
[Service]
RestartSec=2s
Type=simple
User=git
Group=git
WorkingDirectory=/var/lib/forgejo/
ExecStart=/usr/local/bin/forgejo web --config /etc/forgejo/app.ini
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/forgejo
[Install]
WantedBy=multi-user.target
EOF
$STD systemctl enable -q --now forgejo
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"