Compare commits

..

6 Commits

Author SHA1 Message Date
Andrey Melnikov
9f05ab150a Merge pull request #913 from Vafilor/feat/add.deep.learning.desktop
feat: added deep learning desktop workspace
2021-04-14 11:01:56 -07:00
Andrey Melnikov
81de77d88b feat: added description to deep learning workspace 2021-04-14 10:58:22 -07:00
Andrey Melnikov
ea47eaf49d feat: added deep learning desktop workspace 2021-04-14 10:22:24 -07:00
Andrey Melnikov
1b2d5623b4 Merge pull request #908 from Vafilor/fix/release.command.repo
fix: updated repo in generate release notes as the name has changed
2021-04-01 16:31:42 -07:00
Andrey Melnikov
86895a9dfe Update README.md 2021-04-01 14:44:37 -07:00
Andrey Melnikov
ec94a13cd9 fix: updated repo in generate release notes as the name has changed 2021-04-01 10:53:26 -07:00
6 changed files with 175 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
<img width="200px" src="img/logo.png"> <img width="200px" src="img/logo.png">
![build](https://img.shields.io/github/workflow/status/onepanelio/core/Publish%20dev%20docker%20image/master?color=01579b) ![build](https://img.shields.io/github/workflow/status/onepanelio/onepanel/Publish%20dev%20docker%20image/master?color=01579b)
![code](https://img.shields.io/codacy/grade/d060fc4d1ac64b85b78f85c691ead86a?color=01579b) ![code](https://img.shields.io/codacy/grade/d060fc4d1ac64b85b78f85c691ead86a?color=01579b)
[![release](https://img.shields.io/github/v/release/onepanelio/core?color=01579b)](https://github.com/onepanelio/core/releases) [![release](https://img.shields.io/github/v/release/onepanelio/core?color=01579b)](https://github.com/onepanelio/core/releases)
[![sdk](https://img.shields.io/pypi/v/onepanel-sdk?color=01579b&label=sdk)](https://pypi.org/project/onepanel-sdk/) [![sdk](https://img.shields.io/pypi/v/onepanel-sdk?color=01579b&label=sdk)](https://pypi.org/project/onepanel-sdk/)

View File

@@ -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{

View 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)
}

View File

@@ -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)

View File

@@ -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.

View 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