mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-11-03 23:33:41 +00:00 
			
		
		
		
	move rsync and s3 options to configuration
This commit is contained in:
		@ -68,12 +68,14 @@ Remote synchronization settings.
 | 
			
		||||
 | 
			
		||||
Group name must refer to architecture, e.g. it should be `rsync_x86_64` for x86_64 architecture. Requires `rsync` package to be installed. Do not forget to configure ssh for user `ahriman`.
 | 
			
		||||
 | 
			
		||||
* `command` - rsync command to run, space separated list of string, required.
 | 
			
		||||
* `remote` - remote server to rsync (e.g. `1.2.3.4:5678:path/to/sync`), string, required.
 | 
			
		||||
 | 
			
		||||
### `s3_*` groups
 | 
			
		||||
 | 
			
		||||
Group name must refer to architecture, e.g. it should be `s3_x86_64` for x86_64 architecture. Requires `aws-cli` package to be installed. Do not forget to configure it for user `ahriman`.
 | 
			
		||||
 | 
			
		||||
* `command` - s3 command to run, space separated list of string, required.
 | 
			
		||||
* `bucket` - bucket name (e.g. `s3://bucket/path`), string, required.
 | 
			
		||||
 | 
			
		||||
## `web_*` groups
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ root = /var/lib/ahriman
 | 
			
		||||
 | 
			
		||||
[sign]
 | 
			
		||||
target =
 | 
			
		||||
key =
 | 
			
		||||
 | 
			
		||||
[report]
 | 
			
		||||
target =
 | 
			
		||||
@ -36,10 +35,10 @@ template_path = /usr/share/ahriman/repo-index.jinja2
 | 
			
		||||
target =
 | 
			
		||||
 | 
			
		||||
[rsync]
 | 
			
		||||
remote =
 | 
			
		||||
command = rsync --archive --verbose --compress --partial --delete
 | 
			
		||||
 | 
			
		||||
[s3]
 | 
			
		||||
bucket =
 | 
			
		||||
command = aws s3 sync --quiet --delete
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
templates = /usr/share/ahriman
 | 
			
		||||
@ -40,6 +40,7 @@ class Rsync(Upload):
 | 
			
		||||
        """
 | 
			
		||||
        Upload.__init__(self, architecture, config)
 | 
			
		||||
        section = config.get_section_name("rsync", architecture)
 | 
			
		||||
        self.command = config.getlist(section, "command")
 | 
			
		||||
        self.remote = config.get(section, "remote")
 | 
			
		||||
 | 
			
		||||
    def sync(self, path: Path) -> None:
 | 
			
		||||
@ -47,14 +48,4 @@ class Rsync(Upload):
 | 
			
		||||
        sync data to remote server
 | 
			
		||||
        :param path: local path to sync
 | 
			
		||||
        """
 | 
			
		||||
        Rsync._check_output(
 | 
			
		||||
            "rsync",
 | 
			
		||||
            "--archive",
 | 
			
		||||
            "--verbose",
 | 
			
		||||
            "--compress",
 | 
			
		||||
            "--partial",
 | 
			
		||||
            "--delete",
 | 
			
		||||
            str(path),
 | 
			
		||||
            self.remote,
 | 
			
		||||
            exception=None,
 | 
			
		||||
            logger=self.logger)
 | 
			
		||||
        Rsync._check_output(*self.command, str(path), self.remote, exception=None, logger=self.logger)
 | 
			
		||||
 | 
			
		||||
@ -41,6 +41,7 @@ class S3(Upload):
 | 
			
		||||
        Upload.__init__(self, architecture, config)
 | 
			
		||||
        section = config.get_section_name("s3", architecture)
 | 
			
		||||
        self.bucket = config.get(section, "bucket")
 | 
			
		||||
        self.command = config.getlist(section, "command")
 | 
			
		||||
 | 
			
		||||
    def sync(self, path: Path) -> None:
 | 
			
		||||
        """
 | 
			
		||||
@ -48,6 +49,4 @@ class S3(Upload):
 | 
			
		||||
        :param path: local path to sync
 | 
			
		||||
        """
 | 
			
		||||
        # TODO rewrite to boto, but it is bullshit
 | 
			
		||||
        S3._check_output("aws", "s3", "sync", "--quiet", "--delete", str(path), self.bucket,
 | 
			
		||||
                         exception=None,
 | 
			
		||||
                         logger=self.logger)
 | 
			
		||||
        S3._check_output(*self.command, str(path), self.bucket, exception=None, logger=self.logger)
 | 
			
		||||
 | 
			
		||||
@ -21,7 +21,6 @@ root = /var/lib/ahriman
 | 
			
		||||
 | 
			
		||||
[sign]
 | 
			
		||||
target =
 | 
			
		||||
key =
 | 
			
		||||
 | 
			
		||||
[report]
 | 
			
		||||
target =
 | 
			
		||||
@ -36,10 +35,12 @@ template_path = ../web/templates/repo-index.jinja2
 | 
			
		||||
target =
 | 
			
		||||
 | 
			
		||||
[rsync]
 | 
			
		||||
command = rsync --archive --verbose --compress --partial --delete
 | 
			
		||||
remote =
 | 
			
		||||
 | 
			
		||||
[s3]
 | 
			
		||||
bucket =
 | 
			
		||||
command = aws s3 sync --quiet --delete
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
templates = ../web/templates
 | 
			
		||||
		Reference in New Issue
	
	Block a user