Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a80051229 | |||
| e4ee6d548e | |||
| 8a61d9fa37 | |||
| a813388920 |
+39
-1
@@ -1,7 +1,9 @@
|
||||
package bolt
|
||||
|
||||
import (
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
"time"
|
||||
|
||||
@@ -11,7 +13,7 @@ import (
|
||||
"github.com/portainer/portainer/api/bolt/tunnelserver"
|
||||
|
||||
"github.com/boltdb/bolt"
|
||||
"github.com/portainer/portainer/api"
|
||||
portainer "github.com/portainer/portainer/api"
|
||||
"github.com/portainer/portainer/api/bolt/dockerhub"
|
||||
"github.com/portainer/portainer/api/bolt/endpoint"
|
||||
"github.com/portainer/portainer/api/bolt/endpointgroup"
|
||||
@@ -34,6 +36,7 @@ import (
|
||||
|
||||
const (
|
||||
databaseFileName = "portainer.db"
|
||||
dbBackupFileName = "portainer-1-24-backup.db"
|
||||
)
|
||||
|
||||
// Store defines the implementation of portainer.DataStore using
|
||||
@@ -284,3 +287,38 @@ func (store *Store) initServices() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (store *Store) Backup1_24db() error {
|
||||
version, err := store.VersionService.DBVersion()
|
||||
if err != nil && err != portainer.ErrObjectNotFound {
|
||||
return err
|
||||
}
|
||||
|
||||
if version != 24 {
|
||||
return nil
|
||||
}
|
||||
|
||||
databasePath := path.Join(store.path, databaseFileName)
|
||||
dbBackupPath := path.Join(store.path, dbBackupFileName)
|
||||
|
||||
source, err := os.Open(databasePath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer source.Close()
|
||||
|
||||
destination, err := os.Create(dbBackupPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
defer destination.Close()
|
||||
|
||||
_, err = io.Copy(destination, source)
|
||||
if err == nil {
|
||||
log.Println("backup for 1.24 finished successfully.")
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -63,10 +63,16 @@ func initStore(dataStorePath string, fileService portainer.FileService) *bolt.St
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = store.Backup1_24db()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
err = store.MigrateData()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
return store
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1011,7 +1011,7 @@ type (
|
||||
|
||||
const (
|
||||
// APIVersion is the version number of the Portainer API
|
||||
APIVersion = "1.24.2"
|
||||
APIVersion = "1.25.0"
|
||||
// DBVersion is the version number of the Portainer database
|
||||
DBVersion = 24
|
||||
// AssetsServerURL represents the URL of the Portainer asset server
|
||||
|
||||
@@ -225,6 +225,23 @@ angular.module('portainer.app').factory('ModalService', [
|
||||
);
|
||||
};
|
||||
|
||||
service.upgradeNotification = function () {
|
||||
bootbox.dialog({
|
||||
size: 'extra-large',
|
||||
title: 'Upgrade notification',
|
||||
message: `You are currently using version 1.x of Portainer, which is no longer supported maintained or enhanced. Continuing to use this version is at your own risk.
|
||||
<br/><br/>Please upgrade immediately by using the tag <code>portainer/portainer-ce:2.0.1</code>
|
||||
<br/><br/>If you decide to stay on version 1, please use the tag <code>portainer/portainer:1.24.2</code> to prevent automatically upgrading to version 2, as <code>portainer:latest</code> will be updated to version 2 from May.`,
|
||||
onEscape: false,
|
||||
buttons: {
|
||||
Close: {
|
||||
label: 'Close',
|
||||
className: 'btn-primary',
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return service;
|
||||
},
|
||||
]);
|
||||
|
||||
@@ -19,7 +19,8 @@ class AuthenticationController {
|
||||
SettingsService,
|
||||
URLHelper,
|
||||
LocalStorage,
|
||||
StatusService
|
||||
StatusService,
|
||||
ModalService
|
||||
) {
|
||||
this.$async = $async;
|
||||
this.$scope = $scope;
|
||||
@@ -37,6 +38,7 @@ class AuthenticationController {
|
||||
this.URLHelper = URLHelper;
|
||||
this.LocalStorage = LocalStorage;
|
||||
this.StatusService = StatusService;
|
||||
this.ModalService = ModalService;
|
||||
|
||||
this.logo = this.StateManager.getState().application.logo;
|
||||
this.formValues = {
|
||||
@@ -157,6 +159,7 @@ class AuthenticationController {
|
||||
}
|
||||
} finally {
|
||||
this.StateManager.setVersionInfo(versionInfo);
|
||||
this.ModalService.upgradeNotification();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"author": "Portainer.io",
|
||||
"name": "portainer",
|
||||
"homepage": "http://portainer.io",
|
||||
"version": "1.24.2",
|
||||
"version": "1.25.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git@github.com:portainer/portainer.git"
|
||||
|
||||
Reference in New Issue
Block a user