This commit is contained in:
2020-06-06 18:55:21 +00:00
parent 92909bc1dd
commit 944989beae
4 changed files with 51 additions and 19 deletions

View File

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

View File

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

View File

@@ -2,15 +2,6 @@ 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

View File

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