mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-06-16 05:55:33 +00:00
remove temp path
This commit is contained in:
parent
aff18fa091
commit
f0448cd1b9
1
.gitignore
vendored
1
.gitignore
vendored
@ -36,3 +36,4 @@ main
|
|||||||
github.com
|
github.com
|
||||||
.all-contributorsrc
|
.all-contributorsrc
|
||||||
dist
|
dist
|
||||||
|
CasaOS
|
@ -60,8 +60,8 @@ BUILD_PATH=$(dirname "${BASH_SOURCE[0]}")/../../..
|
|||||||
SOURCE_ROOT=${BUILD_PATH}/sysroot
|
SOURCE_ROOT=${BUILD_PATH}/sysroot
|
||||||
|
|
||||||
APP_NAME="casaos"
|
APP_NAME="casaos"
|
||||||
# APP_NAME_FORMAL="CasaOS"
|
APP_NAME_FORMAL="CasaOS"
|
||||||
APP_NAME_FORMAL="casaos-alpha"
|
#APP_NAME_FORMAL="casaos-alpha"
|
||||||
|
|
||||||
# check if migration is needed
|
# check if migration is needed
|
||||||
SOURCE_BIN_PATH=${SOURCE_ROOT}/usr/bin
|
SOURCE_BIN_PATH=${SOURCE_ROOT}/usr/bin
|
||||||
@ -153,7 +153,8 @@ pushd "${MIGRATION_SERVICE_DIR}"
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MIGRATION_TOOL_URL=https://github.com/LinkLeong/"${APP_NAME_FORMAL}"/releases/download/"${VER2}"/linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz
|
# MIGRATION_TOOL_URL=http://192.168.2.197:8000/v1/package/migration?type=release&name="${APP_NAME_FORMAL}"&version=${VER2}&arch=${ARCH}
|
||||||
|
MIGRATION_TOOL_URL=https://github.com/IceWhaleTech/"${APP_NAME_FORMAL}"/releases/download/"${VER2}"/linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz
|
||||||
echo "Dowloading ${MIGRATION_TOOL_URL}..."
|
echo "Dowloading ${MIGRATION_TOOL_URL}..."
|
||||||
curl -sL -O "${MIGRATION_TOOL_URL}"
|
curl -sL -O "${MIGRATION_TOOL_URL}"
|
||||||
done
|
done
|
||||||
|
@ -11,7 +11,6 @@ DateFormat = 2006-01-02
|
|||||||
DBPath = /var/lib/casaos
|
DBPath = /var/lib/casaos
|
||||||
ShellPath = /usr/share/casaos/shell
|
ShellPath = /usr/share/casaos/shell
|
||||||
UserDataPath = /var/lib/casaos/conf
|
UserDataPath = /var/lib/casaos/conf
|
||||||
TempPath = /var/lib/casaos/temp
|
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
RunMode = release
|
RunMode = release
|
||||||
|
@ -11,7 +11,6 @@ DateFormat = 2006-01-02
|
|||||||
DBPath = /var/lib/casaos
|
DBPath = /var/lib/casaos
|
||||||
ShellPath = /usr/share/casaos/shell
|
ShellPath = /usr/share/casaos/shell
|
||||||
UserDataPath = /var/lib/casaos/conf
|
UserDataPath = /var/lib/casaos/conf
|
||||||
TempPath = /var/lib/casaos/temp
|
|
||||||
|
|
||||||
[server]
|
[server]
|
||||||
RunMode = release
|
RunMode = release
|
||||||
|
@ -40,7 +40,6 @@ type APPModel struct {
|
|||||||
DateFormat string
|
DateFormat string
|
||||||
DBPath string
|
DBPath string
|
||||||
ShellPath string
|
ShellPath string
|
||||||
TempPath string
|
|
||||||
}
|
}
|
||||||
type CommonModel struct {
|
type CommonModel struct {
|
||||||
RuntimePath string
|
RuntimePath string
|
||||||
|
@ -86,9 +86,6 @@ func InitSetup(config string) {
|
|||||||
if len(AppInfo.UserDataPath) == 0 {
|
if len(AppInfo.UserDataPath) == 0 {
|
||||||
AppInfo.UserDataPath = "/var/lib/casaos/conf"
|
AppInfo.UserDataPath = "/var/lib/casaos/conf"
|
||||||
}
|
}
|
||||||
if len(AppInfo.TempPath) == 0 {
|
|
||||||
AppInfo.TempPath = "/var/lib/casaos/temp"
|
|
||||||
}
|
|
||||||
if len(CommonInfo.RuntimePath) == 0 {
|
if len(CommonInfo.RuntimePath) == 0 {
|
||||||
CommonInfo.RuntimePath = "/var/run/casaos"
|
CommonInfo.RuntimePath = "/var/run/casaos"
|
||||||
}
|
}
|
||||||
|
@ -761,7 +761,7 @@ func ChangAppState(c *gin.Context) {
|
|||||||
func ContainerLog(c *gin.Context) {
|
func ContainerLog(c *gin.Context) {
|
||||||
appId := c.Param("id")
|
appId := c.Param("id")
|
||||||
log, _ := service.MyService.Docker().DockerContainerLog(appId)
|
log, _ := service.MyService.Docker().DockerContainerLog(appId)
|
||||||
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: log})
|
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: string(log)})
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 获取容器状态
|
// @Summary 获取容器状态
|
||||||
|
@ -16,7 +16,6 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/IceWhaleTech/CasaOS/model"
|
"github.com/IceWhaleTech/CasaOS/model"
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/config"
|
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
|
"github.com/IceWhaleTech/CasaOS/pkg/utils/common_err"
|
||||||
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
|
"github.com/IceWhaleTech/CasaOS/pkg/utils/file"
|
||||||
"github.com/IceWhaleTech/CasaOS/service"
|
"github.com/IceWhaleTech/CasaOS/service"
|
||||||
@ -267,6 +266,9 @@ func DirPath(c *gin.Context) {
|
|||||||
|
|
||||||
pathList := []model.Path{}
|
pathList := []model.Path{}
|
||||||
for i := 0; i < len(info); i++ {
|
for i := 0; i < len(info); i++ {
|
||||||
|
if info[i].Name == ".temp" && info[i].IsDir {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if _, ok := fileQueue[info[i].Path]; !ok {
|
if _, ok := fileQueue[info[i].Path]; !ok {
|
||||||
pathList = append(pathList, info[i])
|
pathList = append(pathList, info[i])
|
||||||
}
|
}
|
||||||
@ -367,7 +369,7 @@ func GetFileUpload(c *gin.Context) {
|
|||||||
path := c.Query("path")
|
path := c.Query("path")
|
||||||
dirPath := ""
|
dirPath := ""
|
||||||
hash := file.GetHashByContent([]byte(fileName))
|
hash := file.GetHashByContent([]byte(fileName))
|
||||||
tempDir := config.AppInfo.TempPath + "/" + hash + strconv.Itoa(totalChunks) + "/"
|
tempDir := filepath.Join(path, ".temp", hash+strconv.Itoa(totalChunks)) + "/"
|
||||||
if fileName != relative {
|
if fileName != relative {
|
||||||
dirPath = strings.TrimSuffix(relative, fileName)
|
dirPath = strings.TrimSuffix(relative, fileName)
|
||||||
tempDir += dirPath
|
tempDir += dirPath
|
||||||
@ -406,7 +408,7 @@ func PostFileUpload(c *gin.Context) {
|
|||||||
c.JSON(common_err.INVALID_PARAMS, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
c.JSON(common_err.INVALID_PARAMS, model.Result{Success: common_err.INVALID_PARAMS, Message: common_err.GetMsg(common_err.INVALID_PARAMS)})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tempDir := config.AppInfo.TempPath + "/" + hash + strconv.Itoa(totalChunks) + "/"
|
tempDir := filepath.Join(path, ".temp", hash+strconv.Itoa(totalChunks)) + "/"
|
||||||
|
|
||||||
if fileName != relative {
|
if fileName != relative {
|
||||||
dirPath = strings.TrimSuffix(relative, fileName)
|
dirPath = strings.TrimSuffix(relative, fileName)
|
||||||
|
@ -130,10 +130,6 @@ func (o *casaService) AsyncGetServerList() (collection model.ServerAppListCollec
|
|||||||
errr := json2.Unmarshal(results, &collection)
|
errr := json2.Unmarshal(results, &collection)
|
||||||
if errr != nil {
|
if errr != nil {
|
||||||
loger.Error("marshal error", zap.Any("err", err), zap.Any("content", string(results)))
|
loger.Error("marshal error", zap.Any("err", err), zap.Any("content", string(results)))
|
||||||
} else {
|
|
||||||
if collection.Version == o.GetCasaosVersion().Version {
|
|
||||||
return collection, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
head := make(map[string]string)
|
head := make(map[string]string)
|
||||||
@ -204,10 +200,6 @@ func (o *casaService) AsyncGetServerCategoryList() ([]model.CategoryList, error)
|
|||||||
err := json2.Unmarshal(results, &list)
|
err := json2.Unmarshal(results, &list)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
loger.Error("marshal error", zap.Any("err", err), zap.Any("content", string(results)))
|
loger.Error("marshal error", zap.Any("err", err), zap.Any("content", string(results)))
|
||||||
} else {
|
|
||||||
if list.Version == o.GetCasaosVersion().Version {
|
|
||||||
return list.Item, nil
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
item := []model.CategoryList{}
|
item := []model.CategoryList{}
|
||||||
head := make(map[string]string)
|
head := make(map[string]string)
|
||||||
|
@ -52,7 +52,7 @@ type DockerService interface {
|
|||||||
DockerContainerStop(id string) error
|
DockerContainerStop(id string) error
|
||||||
DockerContainerUpdateName(name, id string) (err error)
|
DockerContainerUpdateName(name, id string) (err error)
|
||||||
DockerContainerUpdate(m model.CustomizationPostData, id string) (err error)
|
DockerContainerUpdate(m model.CustomizationPostData, id string) (err error)
|
||||||
DockerContainerLog(name string) (string, error)
|
DockerContainerLog(name string) ([]byte, error)
|
||||||
DockerContainerCommit(name string)
|
DockerContainerCommit(name string)
|
||||||
DockerContainerList() []types.Container
|
DockerContainerList() []types.Container
|
||||||
DockerNetworkModelList() []types.NetworkResource
|
DockerNetworkModelList() []types.NetworkResource
|
||||||
@ -677,23 +677,26 @@ func (ds *dockerService) DockerContainerStart(name string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 查看日志
|
// 查看日志
|
||||||
func (ds *dockerService) DockerContainerLog(name string) (string, error) {
|
func (ds *dockerService) DockerContainerLog(name string) ([]byte, error) {
|
||||||
cli, err := client2.NewClientWithOpts(client2.FromEnv)
|
cli, err := client2.NewClientWithOpts(client2.FromEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return []byte(""), err
|
||||||
}
|
}
|
||||||
defer cli.Close()
|
defer cli.Close()
|
||||||
body, err := cli.ContainerLogs(context.Background(), name, types.ContainerLogsOptions{ShowStderr: true, ShowStdout: true})
|
//body, err := cli.ContainerAttach(context.Background(), name, types.ContainerAttachOptions{Logs: true, Stream: false, Stdin: false, Stdout: false, Stderr: false})
|
||||||
|
body, err := cli.ContainerLogs(context.Background(), name, types.ContainerLogsOptions{ShowStdout: true, ShowStderr: true})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return []byte(""), err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer body.Close()
|
defer body.Close()
|
||||||
content, err := ioutil.ReadAll(body)
|
content, err := ioutil.ReadAll(body)
|
||||||
|
//content, err := ioutil.ReadAll(body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return []byte(""), err
|
||||||
}
|
}
|
||||||
return string(content), nil
|
return content, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func DockerContainerStats1() error {
|
func DockerContainerStats1() error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user