Skip to content

Commit

Permalink
v0.3.7 (IceWhaleTech#600)
Browse files Browse the repository at this point in the history
* add send notify function

* add shell script

* add system notiry

* remove disk and test common package

* update http status

* add share function to common

* remove temp path

* remove /DATA directory initialization - moved to local-storage (IceWhaleTech#578)

* update goreleaser configuration

* wip

* change service type to notify for systemd so its status is OK only when service is initialized successfully

* update CasaOS-Common to fix runtime error

* wip

* add send notify function

* add shell script

* add system notiry

* remove disk and test common package

* update http status

* add share function to common

* remove temp path

* remove /DATA directory initialization - moved to local-storage (IceWhaleTech#578)

* update goreleaser configuration

* wip

* change service type to notify for systemd so its status is OK only when service is initialized successfully

* update CasaOS-Common to fix runtime error

* wip

* wip

* wip

* wip

* wip

* Utilization interface to supplement disk information

* fix upload file

* wip

* wip

* add update url

* wip

* wip

* add change log

* update changelog

Co-authored-by: LinkLeong <a624669980@163.com>
  • Loading branch information
tigerinus and LinkLeong authored Oct 20, 2022
1 parent 8cec47e commit 381fb85
Show file tree
Hide file tree
Showing 57 changed files with 1,326 additions and 2,355 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ __debug_bin
main
github.com
.all-contributorsrc
dist
dist
CasaOS
167 changes: 167 additions & 0 deletions .goreleaser.debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# This is an example .goreleaser.yml file with some sensible defaults.
# Make sure to check the documentation at https://goreleaser.com
project_name: casaos
before:
hooks:
# You may remove this if you don't use go modules.
- go mod tidy
builds:
- id: casaos-amd64
binary: build/sysroot/usr/bin/casaos
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
hooks:
post:
- find build/sysroot -type f | xargs -L 1 realpath --relative-to=build/sysroot > build/sysroot.manifest
- id: casaos-arm64
binary: build/sysroot/usr/bin/casaos
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
hooks:
post:
- find build/sysroot -type f | xargs -L 1 realpath --relative-to=build/sysroot > build/sysroot.manifest
- id: casaos-arm-7
binary: build/sysroot/usr/bin/casaos
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
hooks:
post:
- find build/sysroot -type f | xargs -L 1 realpath --relative-to=build/sysroot > build/sysroot.manifest
- id: casaos-migration-tool-amd64
binary: build/sysroot/usr/bin/casaos-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- amd64
- id: casaos-migration-tool-arm64
binary: build/sysroot/usr/bin/casaos-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm64
- id: casaos-migration-tool-arm-7
binary: build/sysroot/usr/bin/casaos-migration-tool
main: ./cmd/migration-tool
env:
- CGO_ENABLED=1
- CC=arm-linux-gnueabihf-gcc
gcflags:
- all=-N -l
ldflags:
- -extldflags "-static"
tags:
- musl
- netgo
goos:
- linux
goarch:
- arm
goarm:
- "7"
archives:
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}"
id: casaos
builds:
- casaos-amd64
- casaos-arm64
- casaos-arm-7
replacements:
arm: arm-7
files:
- build/**/*
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-migration-tool-v{{ .Version }}"
id: casaos-migration-tool
builds:
- casaos-migration-tool-amd64
- casaos-migration-tool-arm64
- casaos-migration-tool-arm-7
replacements:
arm: arm-7
files:
- build/sysroot/etc/**/*
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# release:
# github:
# owner: IceWhaleTech
# name: CasaOS
# draft: true
# prerelease: auto
# mode: replace
# name_template: "v{{ .Version }}"
release:
github:
owner: IceWhaleTech
name: CasaOS
draft: true
prerelease: auto
mode: replace
name_template: "v{{ .Version }}"
8 changes: 4 additions & 4 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ builds:
goarch:
- arm
goarm:
- "7"
- "7"
archives:
- name_template: "{{ .Os }}-{{ .Arch }}-{{ .ProjectName }}-v{{ .Version }}"
id: casaos
Expand Down Expand Up @@ -159,9 +159,9 @@ changelog:
# name_template: "v{{ .Version }}"
release:
github:
owner: LinkLeong
name: casaos-alpha
owner: IceWhaleTech
name: CasaOS
draft: true
prerelease: auto
mode: replace
name_template: "v{{ .Version }}"
name_template: "v{{ .Version }}"
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

## [0.3.7]

### Added
- [Storage] Disk merge (Beta), you can merge multiple disks into a single storage space (currently you need to enable this feature from the command line)

### Changed
- [Files] Changed the cache file storage location, now the file upload size is not limited by the system disk capacity.
- [Scripts] Updated installation and upgrade scripts to support more Debian-based Linux distributions.
- [Engineering] Refactored Local Storage into a standalone service as part of CasaOS modularization.

### Fixed
- [Apps] App list update mechanism improved, now you can see the latest apps in App Store immediately.
- [Storage] Fixed a lot of known issues


## [0.3.6-alpha.1] - 2022-09-06

Expand Down
63 changes: 30 additions & 33 deletions build/scripts/migration/script.d/03-migrate-casaos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ BUILD_PATH=$(dirname "${BASH_SOURCE[0]}")/../../..
SOURCE_ROOT=${BUILD_PATH}/sysroot

APP_NAME="casaos"
# APP_NAME_FORMAL="CasaOS"
APP_NAME_FORMAL="casaos-alpha"

# check if migration is needed
SOURCE_BIN_PATH=${SOURCE_ROOT}/usr/bin
Expand All @@ -85,6 +83,25 @@ if [ "${NEED_MIGRATION}" = "false" ]; then
exit 0
fi

ARCH="unknown"

case $(uname -m) in
x86_64)
ARCH="amd64"
;;
aarch64)
ARCH="arm64"
;;
armv7l)
ARCH="arm-7"
;;
*)
__error "Unsupported architecture"
;;
esac

__info "ARCH: ${ARCH}"

MIGRATION_SERVICE_DIR=${1}

if [ -z "${MIGRATION_SERVICE_DIR}" ]; then
Expand All @@ -95,10 +112,10 @@ MIGRATION_PATH=()

CURRENT_VERSION_FOUND="false"

# a VERSION_PAIR looks like "v0.3.5 v0.3.6-alpha2"
# a VERSION_PAIR looks like "v0.3.5 <url>"
#
# - "v0.3.5" is the current version installed on this host
# - "v0.3.6-alpha2" is the version of the migration tool from GitHub
# - "<url>" is the url of the migration tool
while read -r VERSION_PAIR; do
if [ -z "${VERSION_PAIR}" ]; then
continue
Expand All @@ -107,15 +124,15 @@ while read -r VERSION_PAIR; do
# obtain "v0.3.5" from "v0.3.5 v0.3.6-alpha2"
VER1=$(echo "${VERSION_PAIR}" | cut -d' ' -f1)

# obtain "v0.3.6-alpha2" from "v0.3.5 v0.3.6-alpha2"
VER2=$(echo "${VERSION_PAIR}" | cut -d' ' -f2)
# obtain "<url>" from "v0.3.5 <url>"
URL=$(eval echo "${VERSION_PAIR}" | cut -d' ' -f2)

if [ "${CURRENT_VERSION}" = "${VER1// /}" ] || [ "${CURRENT_VERSION}" = "LEGACY_WITHOUT_VERSION" ]; then
CURRENT_VERSION_FOUND="true"
fi

if [ "${CURRENT_VERSION_FOUND}" = "true" ]; then
MIGRATION_PATH+=("${VER2// /}")
MIGRATION_PATH+=("${URL// /}")
fi
done < "${MIGRATION_LIST_FILE}"

Expand All @@ -124,47 +141,27 @@ if [ ${#MIGRATION_PATH[@]} -eq 0 ]; then
exit 0
fi

ARCH="unknown"

case $(uname -m) in
x86_64)
ARCH="amd64"
;;
aarch64)
ARCH="arm64"
;;
armv7l)
ARCH="arm-7"
;;
*)
__error "Unsupported architecture"
;;
esac

pushd "${MIGRATION_SERVICE_DIR}"

{ for VER2 in "${MIGRATION_PATH[@]}"; do


MIGRATION_TOOL_FILE=linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz
{ for URL in "${MIGRATION_PATH[@]}"; do
MIGRATION_TOOL_FILE=$(basename "${URL}")

if [ -f "${MIGRATION_TOOL_FILE}" ]; then
__info "Migration tool ${MIGRATION_TOOL_FILE} exists. Skip downloading."
continue
fi

MIGRATION_TOOL_URL=https://github.com/LinkLeong/"${APP_NAME_FORMAL}"/releases/download/"${VER2}"/linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz
echo "Dowloading ${MIGRATION_TOOL_URL}..."
curl -sL -O "${MIGRATION_TOOL_URL}"
__info "Dowloading ${URL}..."
curl -fsSL -o "${MIGRATION_TOOL_FILE}" -O "${URL}"
done
} || {
popd
__error "Failed to download migration tools"
}

{
for VER2 in "${MIGRATION_PATH[@]}"; do
MIGRATION_TOOL_FILE=linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz
for URL in "${MIGRATION_PATH[@]}"; do
MIGRATION_TOOL_FILE=$(basename "${URL}")
__info "Extracting ${MIGRATION_TOOL_FILE}..."
tar zxvf "${MIGRATION_TOOL_FILE}" || __error "Failed to extract ${MIGRATION_TOOL_FILE}"

Expand Down
6 changes: 3 additions & 3 deletions build/scripts/migration/service.d/casaos/migration.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
LEGACY_WITHOUT_VERSION v0.3.6
v0.3.5 v0.3.6
v0.3.5.1 v0.3.6
LEGACY_WITHOUT_VERSION https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz
v0.3.5 https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz
v0.3.5.1 https://github.com/IceWhaleTech/CasaOS/releases/download/v0.3.6/linux-${ARCH}-casaos-migration-tool-v0.3.6.tar.gz
19 changes: 7 additions & 12 deletions build/scripts/setup/service.d/casaos/debian/setup-casaos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,10 @@ if [ ! -f "${CONF_FILE}" ]; then
cp -v "${CONF_FILE_SAMPLE}" "${CONF_FILE}"
fi

if systemctl is-active "${APP_NAME}.service" &>/dev/null ;then
echo "server started"
else
# enable and start service
systemctl daemon-reload

echo "Enabling service..."
systemctl enable --force --no-ask-password "${APP_NAME}.service"

echo "Starting service..."
systemctl start --force --no-ask-password "${APP_NAME}.service"
fi
rm -rf /etc/systemd/system/casaos.service # remove old service file

systemctl daemon-reload

# enable service (without starting)
echo "Enabling service..."
systemctl enable --force --no-ask-password "${APP_NAME}.service"
1 change: 0 additions & 1 deletion build/sysroot/etc/casaos/casaos.conf.sample
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ DateFormat = 2006-01-02
DBPath = /var/lib/casaos
ShellPath = /usr/share/casaos/shell
UserDataPath = /var/lib/casaos/conf
TempPath = /var/lib/casaos/temp

[server]
RunMode = release
Expand Down
3 changes: 2 additions & 1 deletion build/sysroot/usr/lib/systemd/system/casaos.service
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[Unit]
After=casaos-gateway.service
ConditionFileNotEmpty=/etc/casaos/casaos.conf
Description=CasaOS Service
Description=CasaOS Main Service

[Service]
ExecStart=/usr/bin/casaos -c /etc/casaos/casaos.conf
PIDFile=/var/run/casaos/casaos.pid
Restart=always
Type=notify

[Install]
WantedBy=multi-user.target
Empty file.
Loading

0 comments on commit 381fb85

Please sign in to comment.