Skip to content

Commit

Permalink
Initialize 'runtime' dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Oct 5, 2019
1 parent f319b65 commit 9024c3e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 5 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ def test_bootstrap(self, run_command_mock, monkeypatch):
'test -e "$(echo /srv/mydemo/venv)"',
'cd /srv/mydemo/mydemo',
'pip3 install -e .',
'pip3 install wheel',
'pip3 install -r requirements.txt',
'ln -sf /srv/mydemo/venv/bin/mydemo /usr/bin/mydemo',
'mkdir -p /srv/mydemo/runtime',
'chown -R mydemo:mydemo /srv/mydemo/runtime',
'setfacl -Rm "g:mydemo:rwX,d:g:mydemo:rwX" /srv/mydemo/runtime',
'test -e "$(echo /srv/mydemo/runtime/environ)"',
'test -e "$(echo /srv/mydemo/runtime/environ)"',
'egrep "^production$" "/srv/mydemo/runtime/environ"',
'pg_config --version',
Expand Down
3 changes: 2 additions & 1 deletion webscaff/commands/proj/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ def bootstrap(ctx):

with ctx.cd(ctx.paths.remote.project.base):
pip.install(ctx, package='.', editable=True)
pip.install(ctx, package='wheel')
pip.install(ctx, from_req=True)

fs.symlink_entypoint(ctx)

fs.upload_configs(ctx)
fs.create_dir(ctx, ctx.paths.remote.project.runtime.root)
fs.create_environ_file(ctx)

pg.bootstrap(ctx)
Expand Down
15 changes: 13 additions & 2 deletions webscaff/overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,22 @@ def contribute_missing(self):
self.paths.remote.cache = '%s/cache_%s' % (self.paths.remote.temp, project_name)

remote_runtime = paths.runtime
remote_runtime_dir = home_remote / 'runtime'
remote_runtime_root = home_remote / 'runtime'

if paths.runtime.root:
remote_runtime_root = Path(paths.runtime.root)

else:
paths.runtime.root = str(remote_runtime_root)

# Set defaults for runtime subdirectories.
for runtime_dir_name in remote_runtime._config.keys():

if runtime_dir_name == 'root':
continue

if getattr(remote_runtime, runtime_dir_name, None) is None:
setattr(remote_runtime, runtime_dir_name, str(remote_runtime_dir / runtime_dir_name))
setattr(remote_runtime, runtime_dir_name, str(remote_runtime_root / runtime_dir_name))

# Local paths:
paths = self.paths.local.project
Expand Down Expand Up @@ -105,6 +115,7 @@ def global_defaults():
'home': None,
'base': None,
'runtime': {
'root': None, # Runtime root.
'static': None, # Django static directory
'media': None, # Django media directory
'certbot': None, # Certbot webroot dir
Expand Down

0 comments on commit 9024c3e

Please sign in to comment.