reuse existing tooling
This commit is contained in:
@@ -23,29 +23,28 @@ catch_errors
|
|||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
|
|
||||||
if [ ! -d /usr/share/nginx/html ]; then
|
if [[ ! -d /opt/cinny ]]; then
|
||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/cinnyapp/cinny/releases/latest | grep '"tag_name":' | cut -d '"' -f4)
|
if check_for_gh_tag "cinny" "cinnyapp/cinny"; then
|
||||||
if [ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ] || [ ! -f /opt/${APP}_version.txt ]; then
|
msg_info "Backing up Data"
|
||||||
msg_info "Updating ${APP} LXC"
|
cp /opt/cinny/config.json /tmp/cinny_config.json
|
||||||
$STD apk -U upgrade
|
msg_ok "Backed up Data"
|
||||||
temp_file=$(mktemp)
|
|
||||||
curl -fsSL "https://github.com/cinnyapp/cinny/releases/download/${RELEASE}/cinny-${RELEASE}.tar.gz" -o "$temp_file"
|
CLEAN_INSTALL=1 fetch_and_deploy_gh_tag "cinny" "cinnyapp/cinny"
|
||||||
cp /usr/share/nginx/html/config.json /tmp/cinny_config.json
|
|
||||||
rm -rf /usr/share/nginx/html/*
|
msg_info "Restoring Configuration"
|
||||||
tar -xzf "$temp_file" --strip-components=1 -C /usr/share/nginx/html
|
cp /tmp/cinny_config.json /opt/cinny/config.json
|
||||||
cp /tmp/cinny_config.json /usr/share/nginx/html/config.json
|
rm -f /tmp/cinny_config.json
|
||||||
rm -f /tmp/cinny_config.json "$temp_file"
|
msg_ok "Restored Configuration"
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
|
||||||
|
msg_info "Restarting nginx"
|
||||||
$STD rc-service nginx restart
|
$STD rc-service nginx restart
|
||||||
msg_ok "Updated successfully!"
|
msg_ok "Updated successfully!"
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
start
|
start
|
||||||
|
|||||||
@@ -19,19 +19,16 @@ $STD apk add --no-cache \
|
|||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Cinny"
|
msg_info "Installing Cinny"
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/cinnyapp/cinny/releases/latest | grep '"tag_name":' | cut -d '"' -f4)
|
|
||||||
temp_file=$(mktemp)
|
fetch_and_deploy_gh_tag "cinny" "cinnyapp/cinny"
|
||||||
curl -fsSL "https://github.com/cinnyapp/cinny/releases/download/${RELEASE}/cinny-${RELEASE}.tar.gz" -o "$temp_file"
|
|
||||||
mkdir -p /usr/share/nginx/html
|
|
||||||
tar -xzf "$temp_file" --strip-components=1 -C /usr/share/nginx/html
|
|
||||||
rm -f "$temp_file"
|
|
||||||
cat <<'EOF' >/etc/nginx/http.d/default.conf
|
cat <<'EOF' >/etc/nginx/http.d/default.conf
|
||||||
server {
|
server {
|
||||||
listen 8080;
|
listen 8080;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
root /usr/share/nginx/html/;
|
root /opt/cinny;
|
||||||
|
|
||||||
rewrite ^/config.json$ /config.json break;
|
rewrite ^/config.json$ /config.json break;
|
||||||
rewrite ^/manifest.json$ /manifest.json break;
|
rewrite ^/manifest.json$ /manifest.json break;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
{
|
{
|
||||||
"type": "default",
|
"type": "default",
|
||||||
"script": "ct/alpine-cinny.sh",
|
"script": "ct/alpine-cinny.sh",
|
||||||
"config_path": "/usr/share/nginx/html/config.json",
|
"config_path": "/opt/cinny/config.json",
|
||||||
"resources": {
|
"resources": {
|
||||||
"cpu": 1,
|
"cpu": 1,
|
||||||
"ram": 256,
|
"ram": 256,
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
},
|
},
|
||||||
"notes": [
|
"notes": [
|
||||||
{
|
{
|
||||||
"text": "To see config: `cat /usr/share/nginx/html/config.json`",
|
"text": "To see config: `cat /opt/cinny/config.json`",
|
||||||
"type": "info"
|
"type": "info"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user