Micromata BorgBackup-Butler
===========================
Micromata GmbH, Kai Reinhard
:toc:
:toclevels: 4

Copyright (C) 2018

ifdef::env-github,env-browser[:outfilesuffix: .adoc]

== Configuration


~/.borgbutler/borgbutler-config.json
[source,json]
----
{
  "max_archive_ontent_cache_capacity_mb" : 1000,
  "repo-configs" : [ {
    "display_name" : "My-Laptop-Local-Backup",
    "repo"         : "/Volumes/backup/my-laptop-backup",
  },
  {
    "display_name"    : "My-Laptop-Remote-Backup",
    "repo"            : "ssh://backup.acme.com/./backups/my-laptop",
    "passwordCommand" : "security find-generic-password -a $USER -s borg-passphrase -w",
    "rsh"             : "ssh -i /Users/horst/.ssh/acme_rsa"
  } ]
}
----
* `max_archive_ontent_cache_capacity_mb` specifies the cache size BorgButler may use for caching borg results (such as repository
information, archive information and also file list of archive content).
* `repo-configs`: You may add a list of all your repos with the borg variables. The name is only used for displaying
purposes.

== Build and start from command line

=== Build distribution and start with Gradle
1. `cd borgbackup-butler`
2. `npm install`
3. `cd ..`
4. `gradle distZip`
5. `unzip borgbutler-server/build/distributions/borgbutler-server-0.1-SNAPSHOT.zip`
6. Start BorgButler: `borgbutler-server-0.1-SNAPSHOT/bin/borgbutler-server`

Now the default webbrowser is started on default port `9042`. Enjoy it!


== Build and start inside your IDE

=== Lombok required
[.text-center]
https://github.com/mplushnikov/lombok-intellij-plugin[Lombok Intellij plugin description^] +
[.text-left]
Or go to
[.text-center]
https://projectlombok.org/[Lombok home page^] +
[.text-left]

* Using IDE built-in plugin system on Windows: +
  File > Settings > Plugins > Browse repositories... > Search for "lombok" > Install Plugin
* Using IDE built-in plugin system on MacOs: +
  Preferences > Settings > Plugins > Browse repositories... > Search for "lombok" > Install Plugin
* Manually: +
  Download the latest release and install it manually using Preferences > Plugins > Install plugin from disk..
* In your project: Click Preferences -> Build, Execution, Deployment -> Compiler, Annotation Processors. Click Enable Annotation Processing


=== Start borgbutler-server
1. `cd borgbutler-webapp`
2. `npm install`
3. `gradle npmBuild` (builds the web archive)
4. Start `de.micromata.borgbutler.server.Main`

=== Start borgbutler-server for web development
For using hot code replacement of your web files, you should use `npm start` or `yarn start`:

1. `cd borgbutler-webapp`
2. `npm install`
3. `npm start` (opens the web browser on port 3000)
4. Start `de.micromata.borgbutler.server.Main` (ignore the opened browser window for port 9042)

== Ideas
=== 2 factor authentication
https://github.com/j256/two-factor-auth

== Install server
=== Debian
tbd.