diff options
Diffstat (limited to 'internal/layout/layout.go')
| -rw-r--r-- | internal/layout/layout.go | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/internal/layout/layout.go b/internal/layout/layout.go index 89e6848..636b8ce 100644 --- a/internal/layout/layout.go +++ b/internal/layout/layout.go @@ -55,6 +55,20 @@ func (c Config) NginxConfPath(app string) string { return filepath.Join(c.NginxConfDir, app+".conf") } +func (c Config) PostReceiveHookPath(app string) string { + return filepath.Join(c.RepoPath(app), "hooks", "post-receive") +} + +// RCScriptPath and RCConfPath are paths inside the jail's own chroot, not +// the host's rc.d/rc.conf. +func (c Config) RCScriptPath(app string) string { + return filepath.Join(c.JailRoot(app), "usr", "local", "etc", "rc.d", app) +} + +func (c Config) RCConfPath(app string) string { + return filepath.Join(c.JailRoot(app), "etc", "rc.conf") +} + // Everything below is Capistrano-style: each deploy gets its own immutable // releases/<sha> checkout (built in place, inside the jail's own dataset), // `current` is a symlink to whichever release is live, and data.db/env are @@ -63,8 +77,12 @@ func (c Config) AppDir(app string) string { return filepath.Join(c.JailRoot(app), "app") } +func (c Config) ReleasesDir(app string) string { + return filepath.Join(c.AppDir(app), "releases") +} + func (c Config) ReleaseDir(app, sha string) string { - return filepath.Join(c.AppDir(app), "releases", sha) + return filepath.Join(c.ReleasesDir(app), sha) } func (c Config) CurrentRelease(app string) string { @@ -73,35 +91,14 @@ func (c Config) CurrentRelease(app string) string { // ReleaseDirInJail is releases/<sha> as seen from inside the jail's own // chroot, not the host. The `current` symlink must be written with this -// form as its target: it's dereferenced by the jail's rc.d script (execing -// CurrentBin), where a host-absolute path like ReleaseDir's resolves -// relative to the jail root instead and never exists. +// form as its target: it's dereferenced by the jail's rc.d script (which +// execs /app/current/app, per internal/tmpl/rc.d.tmpl's command_args), +// where a host-absolute path like ReleaseDir's resolves relative to the +// jail root instead and never exists. func (c Config) ReleaseDirInJail(sha string) string { return filepath.Join("/app", "releases", sha) } -// CurrentBin is the path the jail's rc.d script execs - must match -// internal/tmpl/rc.d.tmpl's command_args. -func (c Config) CurrentBin(app string) string { - return filepath.Join(c.CurrentRelease(app), "app") -} - -func (c Config) MakefilePath(app, sha string) string { - return filepath.Join(c.ReleaseDir(app, sha), "Makefile") -} - -func (c Config) DataDB(app string) string { - return filepath.Join(c.AppDir(app), "data.db") -} - -func (c Config) EnvFile(app string) string { - return filepath.Join(c.AppDir(app), "env") -} - func (c Config) MetaPath(app string) string { return filepath.Join(c.AppDir(app), "meta.json") } - -func (c Config) SnapshotName(app, sha string) string { - return fmt.Sprintf("%s@pre-%s", c.AppDataset(app), sha) -} |
