pyinfra-dev / pyinfra-dev/pyinfra

Add an operation to cache generated files

Open
#986 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

operations spec
Dominant language
Python
Stars
6k
Forks
548
Avg merge
7d 17h
Merged PRs (30d)
13

Description

Is your feature request related to a problem? Please describe

I have a pyinfra deploy which sets up a TLS certificate using acmetool: https://github.com/deltachat/pyinfra-acmetool
It generally works, but if I recreate a VM multiple times, I get ratelimited by Let's Encrypt: https://letsencrypt.org/docs/duplicate-certificate-limit/

Describe the solution you'd like

A solution could be to have an operation combining files.get() and files.put().
We could name this operation files.cache(src, dest).
If the src exists locally, this operation should copy the file to remote host, operating like files.put(). Otherwise it should not do anything immediately, but defer a files.get() operation to the end of the deploy.

For example, destination can be a private key file. If the file already exists, it gets deployed on the server. Otherwise the service is started, detects that the key does not exist and generates it, and pyinfra saves it locally for the next deploy.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing files.get() and files.put() operations and how deploy operations are deferred or finalized. The operation is done when an existing local source is copied remotely, while a missing source schedules retrieval at the end of the deploy as described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.