From b351eb779ca4b5f8886bb89a82667cec42d57159 Mon Sep 17 00:00:00 2001 From: Danny Date: Fri, 25 Apr 2025 11:27:42 +0100 Subject: [PATCH] Update Wiki for version 1.1.0 --- Build-Command.md | 29 +++++++++++++++++--------- Configuration.md | 48 +++++++++++++++++++++++++++++--------------- Home.md | 2 +- Quick-Start-Guide.md | 2 +- 4 files changed, 54 insertions(+), 27 deletions(-) diff --git a/Build-Command.md b/Build-Command.md index c0c31fa..94ae6c1 100644 --- a/Build-Command.md +++ b/Build-Command.md @@ -16,24 +16,35 @@ loom spin:up [name] [path] [--options] ### Options -| Option | Description | Example/Accepted Values | -|---------------------|------------------------------------------------|-------------------------| -| --php | Choose PHP version | `8.3`, `8.4`, etc. | -| --disable-xdebug | Disable Xdebug in PHP container | (flag, no value) | -| --database | Select database (currently only sqlite) | `sqlite` | -| --disable-database | Disable database container | (flag, no value) | -| --disable-server | Exclude Nginx web server | (flag, no value) | -| --node | Set Node.js version | `20`, `23`, etc. | +| Option | Description | Example/Accepted Values | +|--------------------|---------------------------------|--------------------------------| +| --php | Choose PHP version | `8.3`, `8.4`, etc. | +| --disable-xdebug | Disable Xdebug in PHP container | (flag, no value) | +| --database | Select database | `mysql`, `sqlite` or `sqlite3` | +| --disable-database | Disable database container | (flag, no value) | +| --disable-server | Exclude Nginx web server | (flag, no value) | +| --node | Set Node.js version | `20`, `23`, etc. | ## What it Does - Reads configuration and builds required project files (Dockerfile, docker-compose). - Spins up the PHP (and optionally Nginx/database) containers for your project. - Automatically mounts your project directory. +- **Creates a `/sqlite` folder in your project root if you have selected SQLite as your database. This folder is used to + store your development SQLite database files, ensuring that your database persists across container rebuilds and is + easily accessible for backups or inspection.** ## Notes - Container configuration is determined only at build time. **To apply changes to config or options, destroy and rebuild your environment.** - Project name becomes the Docker prefix (e.g., `projectname-php`). -- Requires Docker running. \ No newline at end of file +- Requires Docker running. + +## Database Folders and Data + +- **MySQL:** Database data is stored inside a `data/[projectname]/mysql` folder created by the environment, (outside your + project) allowing MySQL data persistence between container restarts. +- **SQLite:** If you enable the SQLite database option, a `sqlite` folder will automatically be created in the root of + your project (if it doesn't already exist). This folder is used to store your SQLite database files. You should add + this folder to your `.gitignore` if you do not wish to track database state in version control. diff --git a/Configuration.md b/Configuration.md index c1488c0..f75e2d0 100644 --- a/Configuration.md +++ b/Configuration.md @@ -1,9 +1,10 @@ # Configuration By default, **Loom Spinner** provides a powerful environment for your PHP projects—no extra configuration required. -However, Loom Spinner is designed to be flexible, so you can easily tailor your environment to suit different project needs. +However, Loom Spinner is designed to be flexible, so you can tailor your environment to suit different project needs. -For example, if you're building a CLI tool and don't need a web server, you can simply pass the `--disable-server` option to the `spin:up` command to exclude Nginx. +For example, if you're building a CLI tool and don't need a web server, you can pass the `--disable-server` option +to the `spin:up` command to exclude Nginx. This page explains how to customize your environments using command line options or a project configuration file. @@ -18,7 +19,8 @@ This page explains how to customize your environments using command line options ## Default Configuration -Every Loom Spinner environment starts with sensible defaults, defined in the [default configuration file](https://forge.winningsoftware.co.uk/LoomLabs/spinner/src/branch/main/config/spinner.yaml) in the repository. +Every Loom Spinner environment starts with sensible defaults, defined in the [default configuration file](https://forge.winningsoftware.co.uk/LoomLabs/spinner/src/branch/main/config/spinner.yaml) in the +repository. --- @@ -26,10 +28,8 @@ Every Loom Spinner environment starts with sensible defaults, defined in the [de You can adjust your environment by: -1. **Passing options to the CLI** - Override settings directly when you run commands. -2. **Creating a `spinner.yaml` config file** - Place this file in your project root to define project-wide defaults. +1. **Passing options to the CLI**: Override settings directly when you run the `spin:up` command. +2. **Creating a `spinner.yaml` config file**: Place this file in your project root to define environment defaults. ### Configuration Priority @@ -41,7 +41,23 @@ When configuring, Loom Spinner checks for values in this order (highest to lowes For example: -If your `spinner.yaml` sets `environment.database.enabled: true`, but you run `spin:up` with `--disable-database`, the CLI flag takes precedence. +If your `spinner.yaml` sets `environment.database.enabled: true`, but you run `spin:up` with `--disable-database`, the +CLI flag takes precedence. + +--- + +## Example: Setting the MySQL Root Password + +You can set the password for the MySQL root user (when the MySQL database is used) in your project configuration file: + +```yaml +options: + environment: + database: + rootPassword: mySecretPassword +``` + +If this option is not provided, the `rootPassword` will be used from the default config. --- @@ -70,14 +86,14 @@ Most configuration options can also be supplied directly at the command line whe ## Available Options -| Option | Config Key | Accepted Values | -|----------------------|---------------------------------------|-------------------------------------------------------| -| `--php` | `environment.php.version` | Any PHP version with a valid Docker FPM image | -| `--disable-xdebug` | `environment.php.xdebug: false` | CLI: none
YAML: `true`/`false` | -| `--database` | - | `sqlite` or `sqlite3` | -| `--disable-database` | `environment.database.enabled: false` | CLI: none
YAML: `true`/`false` | -| `--disable-server` | `environment.server.enabled: false` | CLI: none
YAML: `true`/`false` | -| `--node` | `environment.node.version` | Any valid Node.js version (e.g., `20`) | +| Option | Config Key | Accepted Values | +|----------------------|---------------------------------------|-----------------------------------------------| +| `--php` | `environment.php.version` | Any PHP version with a valid Docker FPM image | +| `--disable-xdebug` | `environment.php.xdebug: false` | CLI: none
YAML: `true`/`false` | +| `--database` | - | `mysql`, `sqlite` or `sqlite3` | +| `--disable-database` | `environment.database.enabled: false` | CLI: none
YAML: `true`/`false` | +| `--disable-server` | `environment.server.enabled: false` | CLI: none
YAML: `true`/`false` | +| `--node` | `environment.node.version` | Any valid Node.js version (e.g., `20`) | For a comprehensive example of all options, see the [`config/spinner.yaml`](https://forge.winningsoftware.co.uk/LoomLabs/spinner/src/branch/main/config/spinner.yaml) in the repository. diff --git a/Home.md b/Home.md index 99172f6..d420728 100644 --- a/Home.md +++ b/Home.md @@ -16,7 +16,7 @@ A typical Loom Spinner environment gives you everything you need to kick off loc - **A PHP Container** with: - PHP 8.4 - Node 23 - - SQLite + - MySQL - XDebug - Opcache - Popular PHP extensions enabled by default diff --git a/Quick-Start-Guide.md b/Quick-Start-Guide.md index bcd0c2c..c6444bc 100644 --- a/Quick-Start-Guide.md +++ b/Quick-Start-Guide.md @@ -30,7 +30,7 @@ loom spin:up my-project . - `my-project` is the name you'll use for this environment. - `.` means "use the current directory as the project root". -Loom Spinner will set up Docker containers with PHP, Nginx, Node, SQLite, and more, based on your configuration and project needs. +Loom Spinner will set up Docker containers with PHP, Nginx, Node, MySQL (or SQLite), and more, based on your configuration and project needs. ## 4. Access Your Project