Skip to content

Commit 27384ad

Browse files
gitea-mirror (#4967)
* 'Add new script' * Update gitea-mirror.sh * Update gitea-mirror-install.sh --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: Tobias <[email protected]>
1 parent 27d3909 commit 27384ad

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

ct/gitea-mirror.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: CrazyWolf13
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/arunavo4/gitea-mirror
7+
8+
APP="gitea-mirror"
9+
var_tags="${var_tags:-mirror;gitea}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-1024}"
12+
var_disk="${var_disk:-5}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
if [[ ! -d /opt/gitea-mirror ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
RELEASE=$(curl -fsSL https://api.github.com/repos/arunavo4/gitea-mirror/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
32+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
33+
34+
msg_info "Stopping Services"
35+
systemctl stop gitea-mirror
36+
msg_ok "Services Stopped"
37+
38+
msg_info "Backup Data"
39+
mkdir -p /opt/gitea-mirror-backup/data
40+
cp /opt/gitea-mirror/data/* /opt/gitea-mirror-backup/data/
41+
msg_ok "Backup Data"
42+
43+
msg_info "Installing Bun"
44+
export BUN_INSTALL=/opt/bun
45+
curl -fsSL https://bun.sh/install | $STD bash
46+
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
47+
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
48+
msg_ok "Installed Bun"
49+
50+
rm -rf /opt/gitea-mirror
51+
fetch_and_deploy_gh_release "arunavo4/gitea-mirror"
52+
53+
msg_info "Updating and rebuilding ${APP} to v${RELEASE}"
54+
cd /opt/gitea-mirror
55+
$STD bun run setup
56+
$STD bun run build
57+
APP_VERSION=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4)
58+
sudo sed -i.bak "s|^Environment=npm_package_version=.*|Environment=npm_package_version=${APP_VERSION}|" /etc/systemd/system/gitea-mirror.service
59+
msg_ok "Updated and rebuilt ${APP} to v${RELEASE}"
60+
61+
msg_info "Restoring Data"
62+
cp /opt/gitea-mirror-backup/data/* /opt/gitea-mirror/data
63+
echo "${RELEASE}" >/opt/${APP}_version.txt
64+
msg_ok "Restored Data"
65+
66+
msg_info "Starting Service"
67+
systemctl daemon-reload
68+
systemctl start gitea-mirror
69+
msg_ok "Service Started"
70+
else
71+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
72+
fi
73+
exit
74+
}
75+
76+
start
77+
build_container
78+
description
79+
80+
msg_ok "Completed Successfully!\n"
81+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
82+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
83+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:4321${CL}"

ct/headers/gitea-mirror

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_ __ _
2+
____ _(_) /____ ____ _ ____ ___ (_)_____________ _____
3+
/ __ `/ / __/ _ \/ __ `/_____/ __ `__ \/ / ___/ ___/ __ \/ ___/
4+
/ /_/ / / /_/ __/ /_/ /_____/ / / / / / / / / / / /_/ / /
5+
\__, /_/\__/\___/\__,_/ /_/ /_/ /_/_/_/ /_/ \____/_/
6+
/____/
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Gitea-Mirror",
3+
"slug": "gitea-mirror",
4+
"categories": [
5+
7
6+
],
7+
"date_created": "2025-06-02",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 4321,
12+
"documentation": "https://github.com/arunavo4/gitea-mirror/",
13+
"config_path": "/etc/systemd/system/gitea-mirror.service",
14+
"website": "https://github.com/arunavo4/gitea-mirror/",
15+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/gitea-mirror.webp",
16+
"description": "Gitea Mirror auto-syncs GitHub repos to your self-hosted Gitea, with a sleek Web UI and easy Docker deployment. ",
17+
"install_methods": [
18+
{
19+
"type": "default",
20+
"script": "ct/gitea-mirror.sh",
21+
"resources": {
22+
"cpu": 1,
23+
"ram": 1024,
24+
"hdd": 5,
25+
"os": "Debian",
26+
"version": "12"
27+
}
28+
}
29+
],
30+
"default_credentials": {
31+
"username": null,
32+
"password": null
33+
},
34+
"notes": []
35+
}

install/gitea-mirror-install.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: CrazyWolf13
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/arunavo4/gitea-mirror
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing dependencies"
17+
$STD apt-get install -y \
18+
build-essential \
19+
openssl \
20+
sqlite3 \
21+
unzip
22+
msg_ok "Installed Dependencies"
23+
24+
msg_info "Installing Bun"
25+
export BUN_INSTALL=/opt/bun
26+
curl -fsSL https://bun.sh/install | $STD bash
27+
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
28+
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
29+
msg_ok "Installed Bun"
30+
31+
fetch_and_deploy_gh_release "arunavo4/gitea-mirror"
32+
33+
msg_info "Installing gitea-mirror"
34+
cd /opt/gitea-mirror
35+
$STD bun run setup
36+
$STD bun run build
37+
msg_ok "Installed gitea-mirror"
38+
39+
msg_info "Creating Services"
40+
JWT_SECRET=$(openssl rand -hex 32)
41+
APP_VERSION=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4)
42+
cat <<EOF >/etc/systemd/system/gitea-mirror.service
43+
[Unit]
44+
Description=Gitea Mirror
45+
After=network.target
46+
[Service]
47+
Type=simple
48+
WorkingDirectory=/opt/gitea-mirror
49+
ExecStart=/usr/local/bin/bun dist/server/entry.mjs
50+
Restart=on-failure
51+
RestartSec=10
52+
Environment=NODE_ENV=production
53+
Environment=HOST=0.0.0.0
54+
Environment=PORT=4321
55+
Environment=DATABASE_URL=file:/opt/gitea-mirror/data/gitea-mirror.db
56+
Environment=JWT_SECRET=${JWT_SECRET}
57+
Environment=npm_package_version=${APP_VERSION}
58+
[Install]
59+
WantedBy=multi-user.target
60+
EOF
61+
systemctl enable -q --now gitea-mirror
62+
msg_ok "Created Service"
63+
64+
motd_ssh
65+
customize
66+
67+
msg_info "Cleaning up"
68+
$STD apt-get -y autoremove
69+
$STD apt-get -y autoclean
70+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)