Skip to content

Commit d4d7392

Browse files
committed
prod: store repositories on efs
1 parent b671bb9 commit d4d7392

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

cfg.production.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ app_client_secret = "${GITHUB_CLIENT_SECRET}"
1010

1111
[git]
1212
local_git = true
13+
cache_dir = "/efs/git-cache"
1314
ssh_key = """
1415
${HOMU_SSH_KEY}
1516
"""

cfg.sample.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@ app_client_secret = ""
2323

2424

2525
[git]
26-
2726
# Use the local Git command. Required to use some advanced features. It also
2827
# speeds up Travis by reducing temporary commits.
2928
#local_git = false
3029

30+
# Directory storing the local clones of the git repositories. If this is on an
31+
# ephemeral file system, there will be a delay to start new builds after a
32+
# restart while homu clones the repository.
33+
# cache_dir = "cache"
34+
3135
# SSH private key. Needed only when the local Git command is used.
3236
#ssh_key = """
3337
#"""

homu/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ def fail(err):
837837

838838

839839
def init_local_git_cmds(repo_cfg, git_cfg):
840-
fpath = 'cache/{}/{}'.format(repo_cfg['owner'], repo_cfg['name'])
840+
fpath = os.path.join(git_cfg["cache_dir"], repo_cfg['owner'], repo_cfg['name'])
841841
genurl = lambda cfg: 'git@github.com:{}/{}.git'.format(cfg['owner'], cfg['name']) # noqa
842842

843843
if not os.path.exists(SSH_KEY_FILE):
@@ -847,6 +847,7 @@ def init_local_git_cmds(repo_cfg, git_cfg):
847847
os.chmod(SSH_KEY_FILE, 0o600)
848848

849849
if not os.path.exists(fpath):
850+
print("initialized local git repository at", fpath)
850851
utils.logged_call(['git', 'init', fpath])
851852

852853
remotes = {
@@ -1693,6 +1694,7 @@ def main():
16931694
'email': user_email,
16941695
'ssh_key': cfg_git.get('ssh_key', ''),
16951696
'local_git': cfg_git.get('local_git', False),
1697+
'cache_dir': cfg_git.get('cache_dir', 'cache')
16961698
}
16971699

16981700
db_file = cfg.get('db', {}).get('file', 'main.db')

0 commit comments

Comments
 (0)