Refactoring backups.
This commit is contained in:
@ -11,6 +11,8 @@
|
||||
#include <memory>
|
||||
#include "server_env.hpp"
|
||||
#include "services.hpp"
|
||||
#include "utils/utils.hpp"
|
||||
#include "utils/assert.hpp"
|
||||
|
||||
namespace dropshell {
|
||||
|
||||
@ -73,13 +75,6 @@ class service_runner {
|
||||
// 4. remove the service directory from the server
|
||||
bool uninstall();
|
||||
|
||||
// backup the service over ssh, using the credentials from server.env (via server_env.hpp)
|
||||
// 1. run backup.sh on the server
|
||||
// 2. create a backup file with format server-service-datetime.tgz
|
||||
// 3. store it in the server's DROPSHELL_DIR/backups folder
|
||||
// 4. copy it to the local user_dir/backups folder
|
||||
bool backup();
|
||||
|
||||
// restore the service over ssh, using the credentials from server.env (via server_env.hpp)
|
||||
// 1. copy the backup file to the server's DROPSHELL_DIR/backups folder
|
||||
// 2. run the restore.sh script on the server, passing the {service_name}.env file as an argument
|
||||
@ -102,7 +97,23 @@ class service_runner {
|
||||
std::string mRemote_service_template_path;
|
||||
std::string mRemote_service_env_file;
|
||||
|
||||
public:
|
||||
std::string sr_get_server_name() const { return m_server_name; }
|
||||
std::string sr_get_service_name() const { return m_service_info.service_name; }
|
||||
std::string sr_get_service_path() const { return m_service_info.path; }
|
||||
std::string sr_get_service_template_name() const { return m_service_info.template_name; }
|
||||
std::string sr_get_local_service_template_path() const { return m_service_info.template_local_path; }
|
||||
|
||||
ServiceInfo sr_get_service_info() const { return m_service_info; }
|
||||
const server_env& sr_get_server_env() const { ASSERT(m_server_env); return *m_server_env; }
|
||||
|
||||
const std::string& sr_get_remote_service_path() const { return mRemote_service_path; }
|
||||
const std::string& sr_get_remote_service_config_path() const { return mRemote_service_config_path; }
|
||||
const std::string& sr_get_remote_service_template_path() const { return mRemote_service_template_path; }
|
||||
const std::string& sr_get_remote_service_env_file() const { return mRemote_service_env_file; }
|
||||
|
||||
// Helper methods
|
||||
public:
|
||||
static std::string construct_ssh_cmd(const server_env &env);
|
||||
|
||||
std::string construct_ssh_cmd() const;
|
||||
|
Reference in New Issue
Block a user