Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: serversideup/spin
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.0.0-beta8
Choose a base ref
...
head repository: serversideup/spin
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on Dec 18, 2024

  1. Enhance Spin debugging capabilities: added SPIN_DEBUG environment var…

    …iable to enable debug logs in the spin script. Updated documentation to include instructions for using SPIN_DEBUG for troubleshooting and added examples for Docker health check failures.
    jaydrogers committed Dec 18, 2024
    Copy the full SHA
    7989d2e View commit details
  2. Fix path references to Ansible vault when running with Docker

    jaydrogers committed Dec 18, 2024
    Copy the full SHA
    936dd97 View commit details
  3. Refactor Ansible vault argument handling to support local and Docker …

    …runs. The `set_ansible_vault_args` function now accepts a `run_type` parameter, allowing for different vault password file paths based on the execution context. This improves flexibility and clarity in vault management.
    jaydrogers committed Dec 18, 2024
    Copy the full SHA
    b1e0bc7 View commit details

Commits on Dec 19, 2024

  1. Ready for v3 stable 🥳

    jaydrogers committed Dec 19, 2024
    Copy the full SHA
    2a78e28 View commit details
6 changes: 5 additions & 1 deletion bin/spin
Original file line number Diff line number Diff line change
@@ -3,6 +3,11 @@ set -e

# Default Environment
SPIN_ENV=${SPIN_ENV:-dev}
SPIN_DEBUG=${SPIN_DEBUG:-false}

if [[ "$SPIN_DEBUG" == "true" ]]; then
set -x
fi

# Set up our structure for our re-used commands
export COMPOSE_CMD=${COMPOSE_CMD:-"docker compose"}
@@ -29,7 +34,6 @@ AUTO_UPDATE_INTERVAL_IN_DAYS=${AUTO_UPDATE_INTERVAL_IN_DAYS:-14}
AUTO_PULL_INTERVAL_IN_DAYS=${AUTO_PULL_INTERVAL_IN_DAYS:-1}

# Ansible Variables
SPIN_ANSIBLE_COLLECTION_NAME="git+https://github.com/serversideup/ansible-collection-spin.git,hardware-support" #TODO: Remove this once we have a new release
SPIN_ANSIBLE_COLLECTION_NAME="${SPIN_ANSIBLE_COLLECTION_NAME:-"serversideup.spin"}"

# Import common functions
14 changes: 14 additions & 0 deletions docs/content/docs/11.community/1.get-help.md
Original file line number Diff line number Diff line change
@@ -17,6 +17,20 @@ You can also run `spin update` to ensure you're on the latest version.

If you're still having issues, sometimes deleting Spin and reinstalling might be a quick fix because it's so easy to delete and reinstall.

## Debugging
If you think you've found a bug in Spin, you can get debug logs by setting the `SPIN_DEBUG` environment variable to `true` before running any commands.

::code-panel
---
label: Set SPIN_DEBUG to true
---
```bash
SPIN_DEBUG=true spin version
```
::

This will show you exactly what Spin is running and these debug logs can help the community help you faster.

## Going back to the stable release
Going back to the stable release is as easy as deleting the `~/.spin` directory then following the installation instructions to reinstall Spin.

Original file line number Diff line number Diff line change
@@ -180,7 +180,26 @@ sudo docker service inspect <service_name> --pretty
```
::

The above command will show nice output of the service configuration and you can look for clues to see why the service might not be starting.
Adding the `--pretty` flag will show nice output of the service configuration and you can look for clues to see why the service might not be starting.

::code-panel
---
label: Example of a Docker health check failure
---
```bash
task: non-zero exit (137): dockerexec: unhealthy container
```
::

If you see an error message like the one above, this means something in the container is causing the Docker health check to fail. This could be caused by a start up script failing, a configuration issue, or something else.

Start up scripts can be tricky to debug because if any of the scripts send a "non-zero exit" code, the Docker health check could fail. Make sure you're properly handling exit codes and testing your scripts in all scenarios.

To get more information, put your container image in debug mode or add verbose logging and try again. You may get more information from `docker service logs` or `docker service inspect`.

::note
If the container you're debugging is **serversideup/php**, you can set container image to debug mode by setting the `LOG_OUTPUT_LEVEL` environment variable to `debug` to get more information.
::

### Reverse Proxy Health Check
If you're trying to access your application through HTTP/HTTPS, but you're getting a 503 or 404 error, it's likely something is wrong with the reverse proxy health check. For our default configurations, we use [Traefik](https://doc.traefik.io/traefik/) as the reverse proxy, so we'll give you a few tips on how to proceed with troubleshooting.
Original file line number Diff line number Diff line change
@@ -216,7 +216,7 @@ We just need to temporarily rename the file so we can reference it.
### Download the new ".spin.yml" file
You can copy the contents of our example file from GitHub and paste into our new `.spin.yml` file.

[View latest .spin.yml file on GitHub →](https://github.com/serversideup/ansible-collection-spin/blob/hardware-support/.spin.example.yml)
[View latest .spin.yml file on GitHub →](https://github.com/serversideup/ansible-collection-spin/blob/main/.spin.example.yml)

### Migrate contents from your ".spin.original.yml" file
Move any setting you'd like, but especially do not forget about these:
8 changes: 4 additions & 4 deletions lib/actions/vault.sh
Original file line number Diff line number Diff line change
@@ -6,18 +6,18 @@ action_vault(){
"${vault_run_command[@]}" --help | sed 's/ansible-vault/spin vault/g'
}

# Read the vault arguments into an array
read -r -a vault_args < <(set_ansible_vault_args)

# Check if ansible-vault is installed locally
if [[ $(command -v ansible-vault) ]]; then
vault_run_command=("ansible-vault")
run_type="local"
else
vault_run_command=("run_ansible" "--mount-path" "$(pwd)" "ansible-vault")
vault_run_command=("run_ansible" "--mount-path" "$(pwd):/ansible" "ansible-vault")
run_type="docker"
fi

# Read the vault arguments into an array
read -r -a vault_args < <(set_ansible_vault_args "$run_type")

# Check if any argument is '--help'
for arg in "$@"; do
if [[ "$arg" == "--help" ]]; then
19 changes: 16 additions & 3 deletions lib/functions.sh
Original file line number Diff line number Diff line change
@@ -276,12 +276,12 @@ download_spin_template_repository() {
laravel)
template_type=official
TEMPLATE_REPOSITORY="serversideup/spin-template-laravel-pro"
branch="${branch:-"onboarding-optimization"}"
branch="${branch:-"main"}"
;;
laravel-pro)
template_type=official
TEMPLATE_REPOSITORY="serversideup/spin-template-laravel-pro"
branch="${branch:-main}"
branch="${branch:-"main"}"
;;
nuxt)
template_type=official
@@ -1330,6 +1330,7 @@ send_to_upgrade_script () {
set_ansible_vault_args() {
local vault_args=()
local variable_file=".spin.yml"
local run_type="${1:-docker}"

if [[ -f .vault-password ]]; then
# Validate the vault password file using Docker
@@ -1351,7 +1352,11 @@ set_ansible_vault_args() {
fi
fi

vault_args+=("--vault-password-file" ".vault-password")
if [[ "$run_type" == "local" ]]; then
vault_args+=("--vault-password-file" ".vault-password")
else
vault_args+=("--vault-password-file" "/ansible/.vault-password")
fi
elif is_encrypted_with_ansible_vault "$variable_file" || is_encrypted_with_ansible_vault ".spin-inventory.ini"; then
echo "${BOLD}${YELLOW}🔐 '.vault-password' file not found. You will be prompted to enter your vault password.${RESET}" >&2
vault_args+=("--ask-vault-pass")
@@ -1361,6 +1366,9 @@ set_ansible_vault_args() {
}

setup_color() {
# Disable debug tracing temporarily
{ set +x; } 2>/dev/null

RAINBOW="
$(printf '\033[38;5;196m')
$(printf '\033[38;5;202m')
@@ -1374,6 +1382,11 @@ setup_color() {
BOLD=$(printf '\033[1m')
RESET=$(printf '\033[m')
MAGENTA=$(printf '\033[1;35m')

# Restore debug tracing if it was enabled
if [[ "${SPIN_DEBUG:-false}" == "true" ]]; then
set -x
fi
}

show_existing_files_warning() {