From 944989beae9dcc814d9de88ca4d2004469473cd6 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Sat, 6 Jun 2020 18:55:21 +0000 Subject: [PATCH] --- devdocs/solutions.txt | 3 +- devdocs/todo.txt | 50 +++++++++++++++++++++--- dist/docker/linux-x64/docker-compose.yml | 11 +----- server/AyaNova/util/RunProgram.cs | 6 +-- 4 files changed, 51 insertions(+), 19 deletions(-) diff --git a/devdocs/solutions.txt b/devdocs/solutions.txt index ad4b0045..c2891833 100644 --- a/devdocs/solutions.txt +++ b/devdocs/solutions.txt @@ -69,7 +69,8 @@ - I guess this way it's reversible if there is an issue but I don't see code to handle any issues - https://github.com/discourse/discourse/tree/master/lib/backup_restore - Also seems to have some capacity to send it to an AWS bitbucket or some thing, maybe an online integration with dropbox or other would be nice - + MORE DOCKER AND DISCOURSE STUFF + https://github.com/discourse/discourse_docker diff --git a/devdocs/todo.txt b/devdocs/todo.txt index d4e86077..135252c5 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -6,17 +6,57 @@ TODO: post to server and test -TODO: restrict server so randos can't login since the client now has all the logins helpfully pre-loaded on it - not sure how to do that and still support phone via cellular network or other people's wifi from logging in - Firewall settings I guess of some kind or maybe require a manual edit to the password, like add a 1 to the end of all of them or something? -todo: add backup turn off setting - environment variable +Backup testing on linux: + +Result of the backup now button: +2020-06-06 18:06:22.4172|ERROR|CoreJobBackup|RunProgram error running command:pg_dump --dbname=postgresql://postgres:letmein@postgresserver:5432/AyaNova -Fc > /var/lib/ayanova/files/backup/manual-db-20200606180622413.backup=>System.ComponentModel.Win32Exception (2): No such file or directory + at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec) + at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo) + at System.Diagnostics.Process.Start() + at AyaNova.Util.RunProgram.RunLinuxBash(String cmd, String arguments, Int32 waitForExitTimeOut) in C:\data\code\raven\server\AyaNova\util\RunProgram.cs:line 96 + at AyaNova.Util.RunProgram.Run(String cmd, String arguments, ILogger log, Int32 waitForExitTimeOut) in C:\data\code\raven\server\AyaNova\util\RunProgram.cs:line 28 +2020-06-06 18:06:22.4365|ERROR|CoreJobBackup|Backup failed=>System.ComponentModel.Win32Exception (2): No such file or directory + at AyaNova.Util.RunProgram.Run(String cmd, String arguments, ILogger log, Int32 waitForExitTimeOut) in C:\data\code\raven\server\AyaNova\util\RunProgram.cs:line 37 + at AyaNova.Biz.CoreJobBackup.DoWorkAsync(Boolean OnDemand) in C:\data\code\raven\server\AyaNova\generator\CoreJobBackup.cs:line 112 +2020-06-06 18:06:22.4399|ERROR|JobsBiz|ProcessJobs::Exclusive -> job Backup (on demand) failed with exception=>System.ComponentModel.Win32Exception (2): No such file or directory + at AyaNova.Biz.CoreJobBackup.DoWorkAsync(Boolean OnDemand) in C:\data\code\raven\server\AyaNova\generator\CoreJobBackup.cs:line 112 + at AyaNova.Biz.CoreJobBackup.DoWorkAsync(Boolean OnDemand) in C:\data\code\raven\server\AyaNova\generator\CoreJobBackup.cs:line 112 + at AyaNova.Biz.JobsBiz.ProcessJobAsync(OpsJob job) in C:\data\code\raven\server\AyaNova\biz\JobsBiz.cs:line 268 + at AyaNova.Biz.JobsBiz.ProcessJobsAsync() in C:\data\code\raven\server\AyaNova\biz\JobsBiz.cs:line 173 + +todo: backup + Change pg_dump stuff to just generic command to call for backup + add switch somewhere to "automatic backup" so can turn off in event of externally done backup + this will take backup processing out of the generator loop + but keep the backup ui so even if external, can download the backup files + + Include pg_dump into AyaNova container so it can call it directly? + https://docs.docker.com/engine/examples/postgresql_service/ + https://docs.docker.com/engine/examples/dotnetcore/ + sudo apt install postgresql-client + Alpine linux install postgres client: + apk add postgresql-client + Alpine linux enter container and run shell from docker: + docker run -it [container_id] /bin/ash + Manual backup command as it's run by AyaNova: + pg_dump --dbname=postgresql://postgres:letmein@postgresserver:5432/AyaNova -Fc > /var/lib/ayanova/files/backup/manual-db-20200606184524472.backup + + +todo: make docker cheat sheet + todo: add backup master time out setting environment variable + + + +TODO: restrict server so randos can't login since the client now has all the logins helpfully pre-loaded on it + not sure how to do that and still support phone via cellular network or other people's wifi from logging in + Firewall settings I guess of some kind or maybe require a manual edit to the password, like add a 1 to the end of all of them or something? + todo: it would be very handy to say the least to be able to run raven locally in linux for testing here maybe virtual box, but I sure don't want to fuck up things, maybe need another computer, some cheap shitbox can test on? is it slowing down development is really the only question I guess diff --git a/dist/docker/linux-x64/docker-compose.yml b/dist/docker/linux-x64/docker-compose.yml index d0f5a0bb..4738bd9e 100644 --- a/dist/docker/linux-x64/docker-compose.yml +++ b/dist/docker/linux-x64/docker-compose.yml @@ -1,16 +1,7 @@ version: '2' services: - - metrics: - image: philhawthorne/docker-influxdb-grafana:latest - restart: always - ports: - - "3003:3003" - - "3004:8083" - - "8086:8086" - - "22022:22" - + postgresserver: image: postgres:alpine restart: always diff --git a/server/AyaNova/util/RunProgram.cs b/server/AyaNova/util/RunProgram.cs index 44a38a4a..ed482400 100644 --- a/server/AyaNova/util/RunProgram.cs +++ b/server/AyaNova/util/RunProgram.cs @@ -25,7 +25,7 @@ namespace AyaNova.Util } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { - return RunLinuxBash(cmd, arguments, waitForExitTimeOut); + return RunLinuxShell(cmd, arguments, waitForExitTimeOut); } } catch (Exception ex) @@ -77,7 +77,7 @@ namespace AyaNova.Util } } - private static string RunLinuxBash(string cmd, string arguments, int waitForExitTimeOut = int.MaxValue) + private static string RunLinuxShell(string cmd, string arguments, int waitForExitTimeOut = int.MaxValue) { var escapedArgs = $"{cmd} {arguments}".Replace("\"", "\\\""); @@ -85,7 +85,7 @@ namespace AyaNova.Util { process.StartInfo = new ProcessStartInfo { - FileName = "/bin/bash", + FileName = "/bin/sh", Arguments = $"-c \"{escapedArgs}\"", RedirectStandardOutput = true, UseShellExecute = false,