Remote synchronization

How to sync repository to another server

There are several choices:

  1. Easy and cheap, just share your local files through the internet, e.g. for nginx:

    server {
        location / {
            autoindex on;
            root /var/lib/ahriman/repository/;
        }
    }
    
  2. You can also upload your packages using rsync to any available server. In order to use it you would need to configure ahriman first:

    [upload]
    target = rsync
    
    [rsync]
    remote = 192.168.0.1:/srv/repo
    

    After that just add /srv/repo to the pacman.conf as usual. You can also upload to S3 (Server = https://s3.eu-central-1.amazonaws.com/repository/aur/x86_64) or to GitHub (Server = https://github.com/ahriman/repository/releases/download/aur-x86_64).

How to sync to S3

  1. Install dependencies:

    pacman -S python-boto3
    
  2. Create a bucket (e.g. repository).

  3. Create an user with write access to the bucket:

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Sid": "ListObjectsInBucket",
                "Effect": "Allow",
                "Action": [
                    "s3:ListBucket"
                ],
                "Resource": [
                    "arn:aws:s3:::repository"
                ]
            },
            {
                "Sid": "AllObjectActions",
                "Effect": "Allow",
                "Action": "s3:*Object",
                "Resource": [
                    "arn:aws:s3:::repository/*"
                ]
            }
        ]
    }
    
  4. Create an API key for the user and store it.

  5. Configure the service as following:

    [upload]
    target = s3
    
    [s3]
    access_key = ...
    bucket = repository
    region = eu-central-1
    secret_key = ...
    

S3 with SSL

In order to configure S3 on custom domain with SSL (and some other features, like redirects), the CloudFront should be used.

  1. Configure S3 as described above.

  2. In bucket properties, enable static website hosting with hosting type “Host a static website”.

  3. Go to AWS Certificate Manager and create public certificate on your domain. Validate domain as suggested.

  4. Go to CloudFront and create distribution. The following settings are required:

    • Origin domain choose S3 bucket.

    • Tick use website endpoint.

    • Disable caching.

    • Select issued certificate.

  5. Point DNS record to CloudFront address.

How to sync to GitHub releases

  1. Create a repository.

  2. Create API key with scope public_repo.

  3. Configure the service as following:

    [upload]
    target = github
    
    [github]
    owner = ahriman
    password = ...
    repository = repository
    username = ahriman