Add more documentation to each instance
This commit adds a new "README.md" file to each instance, adding more documentation.
This commit is contained in:
parent
24ff81f7cd
commit
9a8262b44a
4 changed files with 67 additions and 6 deletions
|
|
@ -220,16 +220,21 @@ func (is StackWithResources) Install(ctx context.Context, progress io.Writer, co
|
|||
}
|
||||
}
|
||||
|
||||
dockerComposeYML := filepath.Join(is.Dir, "docker-compose.yml")
|
||||
|
||||
// update the docker compose file
|
||||
if is.ComposerYML != nil {
|
||||
dst := filepath.Join(is.Dir, "docker-compose.yml")
|
||||
fmt.Fprintf(progress, "[install] %s\n", dst)
|
||||
|
||||
if err := doComposeFile(dst, is.ComposerYML); err != nil {
|
||||
fmt.Fprintf(progress, "[install] %s\n", dockerComposeYML)
|
||||
if err := doComposeFile(dockerComposeYML, is.ComposerYML); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if err := addComposeFileHeader(dockerComposeYML); err != nil {
|
||||
fmt.Fprintf(progress, "[update] %s\n", dockerComposeYML)
|
||||
return err
|
||||
}
|
||||
|
||||
// configure .env
|
||||
envDest := filepath.Join(is.Dir, ".env")
|
||||
if is.EnvContext != nil {
|
||||
|
|
@ -315,6 +320,37 @@ func (is StackWithResources) Install(ctx context.Context, progress io.Writer, co
|
|||
return nil
|
||||
}
|
||||
|
||||
const composeFileHeader = "# This file was automatically created and is updated by the distillery; DO NOT EDIT.\n\n"
|
||||
|
||||
// addComposeFileHeader adds a header to the 'docker-compose.yml' file
|
||||
// indicating it is automatically created
|
||||
func addComposeFileHeader(path string) error {
|
||||
// read existing bytes
|
||||
bytes, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// overwrite the file
|
||||
f, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, umaskfree.DefaultFilePerm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer f.Close()
|
||||
|
||||
// write the header
|
||||
if _, err := f.WriteString(composeFileHeader); err != nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
// write the original content
|
||||
if _, err := f.Write(bytes); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// doComposeFile updates the compose file using the update function.
|
||||
//
|
||||
// If the file at path already exists, calls update with the existing data.
|
||||
|
|
|
|||
26
internal/wisski/ingredient/barrel/barrel/README.md
Normal file
26
internal/wisski/ingredient/barrel/barrel/README.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
This folder contains all files relevant to a specific WissKI Distillery instance.
|
||||
This documentation provides basic information about all files and may be updated in future changes.
|
||||
|
||||
## Container Files
|
||||
|
||||
These are required for the container to function properly.
|
||||
DO NOT EDIT THESE, changes will be overwritten during the next rebuild.
|
||||
|
||||
- `docker-compose.yml`: Defines how the docker image is run
|
||||
- `Dockerfile`: Dockerfile used to run the actual image
|
||||
- `.env`: Parameters for `docker-compose.yml`
|
||||
- `apache.d`, `scripts`, `php.ini.d`: Resources used during the docker-compose build.
|
||||
|
||||
To tweak parameters inside the `.env` file, rebuild the image via `wdcli rebuild`.
|
||||
|
||||
## Data Files
|
||||
|
||||
These contain user data and settings for the instance.
|
||||
You can edit these (changes will __not__ be overwritten).
|
||||
Editing these may still risk breaking your instance; do so at your own risk.
|
||||
|
||||
- `data`: Drupal Installation and user home directory
|
||||
- `ssh`: SSH Host keys; modify at your own risk
|
||||
- `settings.local.php`: settings.php added to this distillery instance
|
||||
- `prefixes.skip`: If this file exists, prefixes from this wisski instance will not be added to the global resolver.
|
||||
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
# THIS FILE IS GENERATED AUTOMATICALLY. DO NOT EDIT.
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue