Skip to content

Commit 4f57120

Browse files
authored
New Script: Onedev (#612)
* onedev * Initial commit * fixes fixes fixes * more fixes * fixes on update * Ready for PR!
1 parent 3c388ef commit 4f57120

File tree

3 files changed

+177
-0
lines changed

3 files changed

+177
-0
lines changed

ct/onedev.sh

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: kristocopani
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+
function header_info {
9+
clear
10+
cat <<"EOF"
11+
____ ____
12+
/ __ \____ ___ / __ \___ _ __
13+
/ / / / __ \/ _ \/ / / / _ \ | / /
14+
/ /_/ / / / / __/ /_/ / __/ |/ /
15+
\____/_/ /_/\___/_____/\___/|___/
16+
17+
EOF
18+
}
19+
header_info
20+
echo -e "Loading..."
21+
APP="OneDev"
22+
var_disk="4"
23+
var_cpu="2"
24+
var_ram="2048"
25+
var_os="debian"
26+
var_version="12"
27+
variables
28+
color
29+
catch_errors
30+
31+
function default_settings() {
32+
CT_TYPE="1"
33+
PW=""
34+
CT_ID=$NEXTID
35+
HN=$NSAPP
36+
DISK_SIZE="$var_disk"
37+
CORE_COUNT="$var_cpu"
38+
RAM_SIZE="$var_ram"
39+
BRG="vmbr0"
40+
NET="dhcp"
41+
GATE=""
42+
APT_CACHER=""
43+
APT_CACHER_IP=""
44+
DISABLEIP6="no"
45+
MTU=""
46+
SD=""
47+
NS=""
48+
MAC=""
49+
VLAN=""
50+
SSH="no"
51+
VERB="no"
52+
echo_default
53+
}
54+
function update_script() {
55+
header_info
56+
check_container_storage
57+
check_container_resources
58+
59+
if [[ ! -f /etc/systemd/system/onedev.service ]]; then
60+
msg_error "No ${APP} Installation Found!"
61+
exit
62+
fi
63+
GITHUB_RELEASE=$(curl -s https://api.github.com/repos/theonedev/onedev/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
64+
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${GITHUB_RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
65+
msg_info "Stopping Service"
66+
systemctl stop onedev
67+
msg_ok "Stopped Service"
68+
69+
msg_info "Updating ${APP} to v${GITHUB_RELEASE}"
70+
cd /opt
71+
wget -q https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz
72+
tar -xzf onedev-latest.tar.gz
73+
/opt/onedev-latest/bin/upgrade.sh /opt/onedev >/dev/null
74+
RELEASE=$(cat /opt/onedev/release.properties | grep "version" | cut -d'=' -f2)
75+
echo "${RELEASE}" >"/opt/${APP}_version.txt"
76+
msg_ok "Updated ${APP} to v${RELEASE}"
77+
78+
msg_info "Starting Service"
79+
systemctl start onedev
80+
msg_ok "Started Service"
81+
82+
msg_info "Cleaning up"
83+
rm -rf /opt/onedev-latest
84+
rm -rf /opt/onedev-latest.tar.gz
85+
msg_ok "Cleaned"
86+
msg_ok "Updated Successfully"
87+
else
88+
msg_ok "No update required. ${APP} is already at v${RELEASE}."
89+
fi
90+
exit
91+
}
92+
93+
start
94+
build_container
95+
description
96+
97+
msg_ok "Completed Successfully!\n"
98+
echo -e "${APP} should be reachable by going to the following URL.
99+
${BL}http://${IP}:6610${CL} \n"

install/onedev-install.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2024 community-scripts ORG
4+
# Author: kristocopani
5+
# License: MIT
6+
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
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+
curl \
19+
mc \
20+
sudo \
21+
default-jdk \
22+
git
23+
msg_ok "Installed Dependencies"
24+
25+
26+
msg_info "Installing OneDev"
27+
cd /opt
28+
wget -q https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz
29+
tar -xzf onedev-latest.tar.gz
30+
mv /opt/onedev-latest /opt/onedev
31+
$STD /opt/onedev/bin/server.sh install
32+
systemctl start onedev
33+
RELEASE=$(cat /opt/onedev/release.properties | grep "version" | cut -d'=' -f2)
34+
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
35+
msg_ok "Installed OneDev"
36+
37+
motd_ssh
38+
customize
39+
40+
msg_info "Cleaning up"
41+
rm -rf /opt/onedev-latest.tar.gz
42+
$STD apt-get -y autoremove
43+
$STD apt-get -y autoclean
44+
msg_ok "Cleaned"

json/onedev.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "OneDev",
3+
"slug": "onedev",
4+
"categories": [
5+
3
6+
],
7+
"date_created": "2024-11-30",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 6610,
12+
"documentation": "https://docs.onedev.io/",
13+
"website": "https://onedev.io/",
14+
"logo": "https://docs.onedev.io/img/logo.svg",
15+
"description": "Git server with CI/CD, kanban, and packages.",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "/ct/onedev.sh",
20+
"resources": {
21+
"cpu": 2,
22+
"ram": 2048,
23+
"hdd": 4,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": null,
31+
"password": null
32+
},
33+
"notes": []
34+
}

0 commit comments

Comments
 (0)