mirror of
https://github.com/onepanelio/onepanel.git
synced 2025-10-04 21:32:39 +08:00
Compare commits
6 Commits
v0.20.0-rc
...
v0.21.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
9f05ab150a | ||
![]() |
81de77d88b | ||
![]() |
ea47eaf49d | ||
![]() |
1b2d5623b4 | ||
![]() |
86895a9dfe | ||
![]() |
ec94a13cd9 |
@@ -1,6 +1,6 @@
|
|||||||
<img width="200px" src="img/logo.png">
|
<img width="200px" src="img/logo.png">
|
||||||
|
|
||||||

|

|
||||||

|

|
||||||
[](https://github.com/onepanelio/core/releases)
|
[](https://github.com/onepanelio/core/releases)
|
||||||
[](https://pypi.org/project/onepanel-sdk/)
|
[](https://pypi.org/project/onepanel-sdk/)
|
||||||
|
@@ -52,7 +52,7 @@ See https://docs.onepanel.ai
|
|||||||
|
|
||||||
` + "```" + `
|
` + "```" + `
|
||||||
# Download the binary
|
# Download the binary
|
||||||
curl -sLO https://github.com/onepanelio/core/releases/download/v%s/opctl-linux-amd64
|
curl -sLO https://github.com/onepanelio/onepanel/releases/download/v%s/opctl-linux-amd64
|
||||||
|
|
||||||
# Make binary executable
|
# Make binary executable
|
||||||
chmod +x opctl-linux-amd64
|
chmod +x opctl-linux-amd64
|
||||||
@@ -68,7 +68,7 @@ opctl version
|
|||||||
|
|
||||||
` + "```" + `
|
` + "```" + `
|
||||||
# Download the binary
|
# Download the binary
|
||||||
curl -sLO https://github.com/onepanelio/core/releases/download/v%s/opctl-macos-amd64
|
curl -sLO https://github.com/onepanelio/onepanel/releases/download/v%s/opctl-macos-amd64
|
||||||
|
|
||||||
# Make binary executable
|
# Make binary executable
|
||||||
chmod +x opctl-macos-amd64
|
chmod +x opctl-macos-amd64
|
||||||
@@ -82,7 +82,7 @@ opctl version
|
|||||||
|
|
||||||
## Windows
|
## Windows
|
||||||
|
|
||||||
Download the [attached executable](https://github.com/onepanelio/core/releases/download/v%s/opctl-windows-amd64.exe), rename it to "opctl" and move it to a folder that is in your PATH environment variable.
|
Download the [attached executable](https://github.com/onepanelio/onepanel/releases/download/v%s/opctl-windows-amd64.exe), rename it to "opctl" and move it to a folder that is in your PATH environment variable.
|
||||||
`
|
`
|
||||||
|
|
||||||
var repositories = []string{
|
var repositories = []string{
|
||||||
|
31
db/go/20210414165510_add_deep_learning_desktop_workspace.go
Normal file
31
db/go/20210414165510_add_deep_learning_desktop_workspace.go
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package migration
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
"github.com/pressly/goose"
|
||||||
|
"path/filepath"
|
||||||
|
)
|
||||||
|
|
||||||
|
var deepLearningDesktopTemplateName = "Deep Learning Desktop"
|
||||||
|
|
||||||
|
func initialize20210414165510() {
|
||||||
|
if _, ok := initializedMigrations[20210414165510]; !ok {
|
||||||
|
goose.AddMigration(Up20210414165510, Down20210414165510)
|
||||||
|
initializedMigrations[20210414165510] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Up20210414165510 creates the Deep Learning Desktop Workspace Template
|
||||||
|
func Up20210414165510(tx *sql.Tx) error {
|
||||||
|
// This code is executed when the migration is applied.
|
||||||
|
return createWorkspaceTemplate(
|
||||||
|
filepath.Join("workspaces", "vnc", "20210414165510.yaml"),
|
||||||
|
deepLearningDesktopTemplateName,
|
||||||
|
"Deep learning desktop with VNC")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Down20210414165510 removes the Deep Learning Desktop Workspace Template
|
||||||
|
func Down20210414165510(tx *sql.Tx) error {
|
||||||
|
// This code is executed when the migration is rolled back.
|
||||||
|
return archiveWorkspaceTemplate(deepLearningDesktopTemplateName)
|
||||||
|
}
|
@@ -94,6 +94,7 @@ func Initialize() {
|
|||||||
initialize20210323175655()
|
initialize20210323175655()
|
||||||
initialize20210329171739()
|
initialize20210329171739()
|
||||||
initialize20210329194731()
|
initialize20210329194731()
|
||||||
|
initialize20210414165510()
|
||||||
|
|
||||||
if err := client.DB.Close(); err != nil {
|
if err := client.DB.Close(); err != nil {
|
||||||
log.Printf("[error] closing db %v", err)
|
log.Printf("[error] closing db %v", err)
|
||||||
|
@@ -1,10 +1,92 @@
|
|||||||
package migration
|
package migration
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
v1 "github.com/onepanelio/core/pkg"
|
v1 "github.com/onepanelio/core/pkg"
|
||||||
uid2 "github.com/onepanelio/core/pkg/util/uid"
|
uid2 "github.com/onepanelio/core/pkg/util/uid"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// createWorkspaceTemplate will create the workspace template given by {{templateName}} with the contents
|
||||||
|
// given by {{filename}}
|
||||||
|
// It will do so for all namespaces.
|
||||||
|
func createWorkspaceTemplate(filename, templateName, description string) error {
|
||||||
|
client, err := getClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer client.DB.Close()
|
||||||
|
|
||||||
|
namespaces, err := client.ListOnepanelEnabledNamespaces()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
newManifest, err := readDataFile(filename)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
uid, err := uid2.GenerateUID(templateName, 30)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, namespace := range namespaces {
|
||||||
|
workspaceTemplate := &v1.WorkspaceTemplate{
|
||||||
|
UID: uid,
|
||||||
|
Name: templateName,
|
||||||
|
Manifest: newManifest,
|
||||||
|
Description: description,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = ReplaceArtifactRepositoryType(client, namespace, nil, workspaceTemplate)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := client.CreateWorkspaceTemplate(namespace.Name, workspaceTemplate); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func archiveWorkspaceTemplate(templateName string) error {
|
||||||
|
client, err := getClient()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer client.DB.Close()
|
||||||
|
|
||||||
|
namespaces, err := client.ListOnepanelEnabledNamespaces()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
uid, err := uid2.GenerateUID(templateName, 30)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, namespace := range namespaces {
|
||||||
|
hasRunning, err := client.WorkspaceTemplateHasRunningWorkspaces(namespace.Name, uid)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Unable to get check running workspaces")
|
||||||
|
}
|
||||||
|
if hasRunning {
|
||||||
|
return fmt.Errorf("unable to archive workspace template. There are running workspaces that use it")
|
||||||
|
}
|
||||||
|
|
||||||
|
_, err = client.ArchiveWorkspaceTemplate(namespace.Name, uid)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// updateWorkspaceTemplateManifest will update the workspace template given by {{templateName}} with the contents
|
// updateWorkspaceTemplateManifest will update the workspace template given by {{templateName}} with the contents
|
||||||
// given by {{filename}}
|
// given by {{filename}}
|
||||||
// It will do so for all namespaces.
|
// It will do so for all namespaces.
|
||||||
|
57
db/yaml/workspaces/vnc/20210414165510.yaml
Normal file
57
db/yaml/workspaces/vnc/20210414165510.yaml
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
arguments:
|
||||||
|
parameters:
|
||||||
|
# parameter screen-resolution allows users to select screen resolution
|
||||||
|
- name: screen-resolution
|
||||||
|
value: 1680x1050
|
||||||
|
type: select.select
|
||||||
|
displayName: Screen Resolution
|
||||||
|
options:
|
||||||
|
- name: 1280x1024
|
||||||
|
value: 1280x1024
|
||||||
|
- name: 1680x1050
|
||||||
|
value: 1680x1050
|
||||||
|
- name: 2880x1800
|
||||||
|
value: 2880x1800
|
||||||
|
containers:
|
||||||
|
- name: ubuntu
|
||||||
|
image: onepanel/vnc:dl-vnc
|
||||||
|
env:
|
||||||
|
- name: VNC_PASSWORDLESS
|
||||||
|
value: true
|
||||||
|
- name: VNC_RESOLUTION
|
||||||
|
value: '{{workflow.parameters.screen-resolution}}'
|
||||||
|
ports:
|
||||||
|
- containerPort: 6901
|
||||||
|
name: vnc
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
ports:
|
||||||
|
- name: vnc
|
||||||
|
port: 80
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 6901
|
||||||
|
routes:
|
||||||
|
- match:
|
||||||
|
- uri:
|
||||||
|
prefix: /
|
||||||
|
route:
|
||||||
|
- destination:
|
||||||
|
port:
|
||||||
|
number: 80
|
||||||
|
# DAG Workflow to be executed once a Workspace action completes (optional)
|
||||||
|
#postExecutionWorkflow:
|
||||||
|
# entrypoint: main
|
||||||
|
# templates:
|
||||||
|
# - name: main
|
||||||
|
# dag:
|
||||||
|
# tasks:
|
||||||
|
# - name: slack-notify
|
||||||
|
# template: slack-notify
|
||||||
|
# - name: slack-notify
|
||||||
|
# container:
|
||||||
|
# image: technosophos/slack-notify
|
||||||
|
# args:
|
||||||
|
# - SLACK_USERNAME=onepanel SLACK_TITLE="Your workspace is ready" SLACK_ICON=https://www.gravatar.com/avatar/5c4478592fe00878f62f0027be59c1bd SLACK_MESSAGE="Your workspace is now running" ./slack-notify
|
||||||
|
# command:
|
||||||
|
# - sh
|
Reference in New Issue
Block a user