+ A place to share and build templates together.
+
{{ template.description }}
+{{ template.author }}
+diff --git a/docs/content/docs/1.installation/1.install-macos.md b/docs/content/docs/1.installation/1.install-macos.md index 11785964..806a843a 100644 --- a/docs/content/docs/1.installation/1.install-macos.md +++ b/docs/content/docs/1.installation/1.install-macos.md @@ -3,7 +3,14 @@ head.title: 'Install to macOS - Spin by Server Side Up' title: 'Install to macOS' description: 'Learn how to install Spin on macOS. No root access required.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/installation/install-macos --- + +# Install to macOS +::lead-p +Spin easily runs on any macOS machine that runs Docker Desktop. Getting started is as simple as installing Docker Desktop, then running a single command to install `spin`. +:: + ## Install Docker Desktop MacOS does not ship with Docker by default. To get Docker installed, you will need "Docker Desktop", which is the official desktop tool developed by Docker. diff --git a/docs/content/docs/1.installation/2.install-windows.md b/docs/content/docs/1.installation/2.install-windows.md index 6d4761ec..4ebbe512 100644 --- a/docs/content/docs/1.installation/2.install-windows.md +++ b/docs/content/docs/1.installation/2.install-windows.md @@ -3,6 +3,7 @@ head.title: 'Install to Windows - Spin by Server Side Up' title: 'Install to Windows' description: 'Learn how to install Spin on Windows using the Linux Subsystem.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/installation/install-windows --- # Install to Windows diff --git a/docs/content/docs/1.installation/3.install-linux.md b/docs/content/docs/1.installation/3.install-linux.md index d3ed4cbb..54074dcd 100644 --- a/docs/content/docs/1.installation/3.install-linux.md +++ b/docs/content/docs/1.installation/3.install-linux.md @@ -3,8 +3,14 @@ head.title: 'Install to Linux - Spin by Server Side Up' title: 'Install to Linux' description: 'Learn how to install Spin on Linux.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/installation/install-linux --- +# Install to Linux +::lead-p +Spin is able to run on any Linux machine that supports Docker. Getting started is as simple as installing Docker, then running a single command to install `spin`. +:: + ## Prerequisites You must have a working installation of Docker. diff --git a/docs/content/docs/1.installation/4.install-composer.md b/docs/content/docs/1.installation/4.install-composer.md index 4bbaa451..29db57df 100644 --- a/docs/content/docs/1.installation/4.install-composer.md +++ b/docs/content/docs/1.installation/4.install-composer.md @@ -3,11 +3,17 @@ head.title: 'Install via Composer - Spin by Server Side Up' title: 'Install via Composer' description: 'Spin can be installed using Composer, a popular PHP package manager. This enables you to make Spin accessible without other developers doing any steps on their end.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/installation/install-composer --- -Installing `spin` at the project level is a great way to deploy `spin` without much configuration from the user's end. [View `spin` on Packagist →](https://packagist.org/packages/serversideup/spin) +# Install via Composer +::lead-p +Spin can be installed using Composer, a popular PHP package manager. This enables you to make Spin accessible without other developers doing any steps on their end. +:: ## Add `spin` to your project with Composer +Installing `spin` at the project level is a great way to deploy `spin` without much configuration from the user's end. [View `spin` on Packagist →](https://packagist.org/packages/serversideup/spin) + We can use Docker to run `composer` and install it on your project. **Run this command from the parent folder of your project.** ::code-panel diff --git a/docs/content/docs/1.installation/5.install-npm-yarn.md b/docs/content/docs/1.installation/5.install-npm-yarn.md index f47877ed..0e248cf8 100644 --- a/docs/content/docs/1.installation/5.install-npm-yarn.md +++ b/docs/content/docs/1.installation/5.install-npm-yarn.md @@ -3,11 +3,17 @@ head.title: 'Install via NPM/Yarn - Spin by Server Side Up' title: 'Install via NPM/Yarn' description: 'Spin can be installed using NPM or Yarn, two popular JavaScript package managers. This enables you to make Spin accessible without other developers doing any steps on their end.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/installation/install-npm-yarn --- -Installing `spin` at the project level is a great way to deploy `spin` without much configuration from the user's end. [View `spin` on NPM →](https://www.npmjs.com/package/@serversideup/spin) +# Install via NPM/Yarn +::lead-p +Spin can be installed using NPM or Yarn, two popular JavaScript package managers. This enables you to make Spin accessible without other developers doing any steps on their end. +:: ## Add `spin` to your project with Yarn/NPM +Installing `spin` at the project level is a great way to deploy `spin` without much configuration from the user's end. [View `spin` on NPM →](https://www.npmjs.com/package/@serversideup/spin) + We can use Docker to run install `spin` on your project. **Run this command from the parent folder of your project.** ::note diff --git a/docs/content/docs/11.community/1.get-help.md b/docs/content/docs/11.community/1.get-help.md new file mode 100644 index 00000000..9c5dfa5d --- /dev/null +++ b/docs/content/docs/11.community/1.get-help.md @@ -0,0 +1,61 @@ +--- +head.title: 'Get Help - Spin by Server Side Up' +title: 'Get Help' +description: 'Learn how to get help with Spin.' +layout: docs +--- + +# Get Help +::lead-p +We're huge believers the product is only as good as the community that supports it. We're here to help you get the most out of Spin. +:: + +## Ensure you're on the latest version +We're always shipping new features and bug fixes for Spin. Ensure you're on the latest release by checking the [releases page](https://github.com/serversideup/spin/releases). + +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. + +::code-panel +--- +label: Delete Spin and reinstall +--- +```bash +rm -rf ~/.spin +``` +:: + +Now follow the installation instructions for your operating system: + +- [Install to macOS](/docs/installation/install-macos) +- [Install to Linux](/docs/installation/install-linux) +- [Install to Windows](/docs/installation/install-windows) + +## Community Support +If you're still having issues, our community primarily uses [GitHub Discussions](https://github.com/serversideup/spin/discussions) and [Discord](https://serversideup.net/discord) to get help with Spin. + +## Resources +We offer a number of resources to help you get the most out of Spin: +- **[Website](https://serversideup.net/open-source/spin)** overview of the product. +- **[Docs](https://serversideup.net/open-source/spin/docs)** for a deep-dive on how to use the product. +- **[Discord](https://serversideup.net/discord)** for friendly support from the community and the team. +- **[GitHub Repo](https://github.com/serversideup/spin)** for source code, bug reports, and project management. +- **[Get Professional Help](https://serversideup.net/professional-support)** - If you need video + screen-sharing support, we offer that too. diff --git a/docs/content/docs/11.community/2.testing.md b/docs/content/docs/11.community/2.testing.md new file mode 100644 index 00000000..cf528712 --- /dev/null +++ b/docs/content/docs/11.community/2.testing.md @@ -0,0 +1,61 @@ +--- +head.title: 'Testing New Releases - Spin by Server Side Up' +title: 'Testing New Releases' +description: 'Learn how to test new releases of Spin.' +layout: docs +--- + +# Testing New Releases +::lead-p +Spin is a collection of many open source projects built by the Server Side Up community. If you're looking for the latest features, here is how you can help test them out. +:: + +## Installing latest Spin beta release +Spin is very lightweight and is installed to your `~/.spin` directory by default. If you'd like to install the latest beta, we can easily + +::code-panel +--- +label: Install latest Spin beta release +--- +```bash +# Ensure previous installation is removed +rm -rf ~/.spin + +# Install the latest release (regardless of pre-release or stable) +bash -c "$(curl -fsSL https://raw.githubusercontent.com/serversideup/spin/main/tools/install.sh)" "" --beta +``` +:: + +## 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. + +::code-panel +--- +label: Delete the ~/.spin directory +--- +```bash +rm -rf ~/.spin +``` +:: + +Now follow the installation instructions for your operating system: + +- [Install to macOS](/docs/installation/install-macos) +- [Install to Linux](/docs/installation/install-linux) +- [Install to Windows](/docs/installation/install-windows) + +## Repositories +There are many repositories that are part of the Spin project. Refer to each repository for instructions on how to test the latest changes. + +#### Ansible Collection +- [Spin Ansible Collection](https://github.com/serversideup/ansible-collection-spin) - Used to provision and maintain your production server. + +#### GitHub Actions +- [serversideup/docker-build-action](https://github.com/marketplace/actions/docker-build-action) - A simplified syntax to build and publish your Docker images with GitHub Actions. +- [serversideup/docker-swarm-deploy-github-action](https://github.com/marketplace/actions/docker-swarm-deploy-github-action) - A simplified syntax to deploy to Docker Swarm Mode via GitHub Actions. + +#### Docker Images +- [serversideup/php](https://serversideup.net/open-source/docker-php/) - PHP Docker images highly optimized to work with Laravel + Spin. +- [serversideup/docker-ssh](https://github.com/serversideup/docker-ssh) - A lightweight docker image that runs SSH. This is a fantastic method on using a secure SSH tunnel into your database cluster. +- [serversideup/docker-ansible](https://github.com/serversideup/docker-ansible) - A lightweight docker image that runs Ansible. This allows users to provision their server without needing to know how to install or maintain their Ansible installation. +- [serversideup/docker-github-cli](https://github.com/serversideup/docker-github-cli) - A lightweight docker image that runs GitHub CLI. This allows users to interact with GitHub without needing to install the GitHub CLI on their machine. \ No newline at end of file diff --git a/docs/content/docs/6.community/3.contributing.md b/docs/content/docs/11.community/3.contributing.md similarity index 100% rename from docs/content/docs/6.community/3.contributing.md rename to docs/content/docs/11.community/3.contributing.md diff --git a/docs/content/docs/2.getting-started/1.how-spin-works.md b/docs/content/docs/2.getting-started/1.how-spin-works.md index 839c17ab..1d659ed9 100644 --- a/docs/content/docs/2.getting-started/1.how-spin-works.md +++ b/docs/content/docs/2.getting-started/1.how-spin-works.md @@ -3,6 +3,7 @@ head.title: 'How Spin Works - Spin by Server Side Up' title: 'How Spin Works' description: 'Learn what Spin is and how it works.' layout: docs +canonical: https://serversideup.net/open-source/spin/docs/getting-started/how-spin-works --- # How Spin Works @@ -10,6 +11,9 @@ layout: docs Spin is a collection of proven open source technologies delivered to you in a lightweight and simple experience. This document explains what technologies Spin uses, how it works, and how this tool can enable you to have a lot of power and freedom to self-host and distribute your applications. :: +## Spin stays out of your way +Spin is designed to be flexible and gives you the power to choose what you'd like Spin to help you with. For example, if you want to use your current PaaS provider for production deployments, but you just want to use Spin for local development, you can easily do that without Spin getting in the way. Simply delete the `docker-compose.prod.yml` file and you won't need to do anything else. + ## What Spin Is Built On Top Of  @@ -18,8 +22,8 @@ At the core of Spin are: - [Docker Swarm Mode](https://docs.docker.com/engine/swarm/) (used in production, staging, etc.) - [Ansible](https://www.ansible.com/) (used to ensure your server is configured correctly) -### Templates -We offer templates to help you get started with Spin, or you can [create your own template](/docs/project-templates/create-your-own-template). +### Templates on Spin Hub +We have organized a [community hub](/hub) where you can find templates created by the Spin team and the community. You can also [create your own template](/docs/advanced/create-your-own-template). ### Flexible deployments With Spin, you have two options for deployments: @@ -39,6 +43,8 @@ Spin accesses and utilizes other open source projects to simplify your developme #### Docker Images - [serversideup/php](https://serversideup.net/open-source/docker-php/) - PHP Docker images highly optimized to work with Laravel + Spin. - [serversideup/docker-ssh](https://github.com/serversideup/docker-ssh) - A lightweight docker image that runs SSH. This is a fantastic method on using a secure SSH tunnel into your database cluster. +- [serversideup/docker-ansible](https://github.com/serversideup/docker-ansible) - A lightweight docker image that runs Ansible. This allows users to provision their server without needing to know how to install or maintain their Ansible installation. +- [serversideup/docker-github-cli](https://github.com/serversideup/docker-github-cli) - A lightweight docker image that runs GitHub CLI. This allows users to interact with GitHub without needing to install the GitHub CLI on their machine. ## Why not just use these technologies directly? Spin is designed to reduce the learning curve for delivering containerized applications with Docker. This is where we believe the 99% of people are. If you're looking to start a new project and deliver it quickly without breaking the bank, Spin is for you. Everything is designed to have your application disposable, repeatable, and scalable. @@ -52,13 +58,7 @@ Spin's flexibility comes from embracing the [Docker Compose Overrides (aka Docke Here is a visual of what the file structure looks like: -::responsive-image ---- -src: /images/docs/whats-spin/docker-compose-overrides.png -alt: 'Docker Compose Overrides' -maxWidth: 500 ---- -:: + Docker natively selecting these files, but it is a huge pain to type out each time. This is what we would have to type to bring our project up. diff --git a/docs/content/docs/2.getting-started/2.create-a-new-project-with-spin.md b/docs/content/docs/2.getting-started/2.create-a-new-project-with-spin.md new file mode 100644 index 00000000..40a14403 --- /dev/null +++ b/docs/content/docs/2.getting-started/2.create-a-new-project-with-spin.md @@ -0,0 +1,41 @@ +--- +head.title: 'Create a New Project with Spin - Spin by Server Side Up' +title: 'Create a New Project with Spin' +description: 'Learn how to create a new project with Spin.' +layout: docs +--- + +# Create a project with Spin +::lead-p +Getting up an running with Spin is very easy. It's recommended to install Spin globally so you can easily create new projects. Follow the installation instructions for [macOS](/docs/installation/install-macos/), [Linux](/docs/installation/install-linux), or [Windows](/docs/installation/install-windows) before continuing. We'll walk you through the process of creating a new Laravel project with Spin. +:: + +## Finding a project on "Spin Hub" +We created a [community hub](/hub) where you can find templates created by the Spin team and the community. We're in the early stages of development, but [anyone can create their own template](/docs/advanced/create-your-own-template) and we will publish it to Spin Hub for you. + +## Let's create a new Laravel project +For our example, we will use the "Laravel" template from Spin Hub. We have a command called `spin new`, which will take care of the heavy lifting for you + +::code-panel +--- +label: "Create a new Laravel project called \"my-billion-dollar-idea\"" +--- +```bash +spin new laravel my-billion-dollar-idea +``` +:: + +This will create a project in your current directory called `my-billion-dollar-idea`. You can also specify a path to create the project in a different directory. + +
+ +
+ +Assuming you completed the prerequisites, the onboard wizard will take you through the process so you can get a local development environment with `spin up`. + +## Starting the development environment +Next, we'll start the development environment with `spin up`. + +[Starting up your Development Environment →](/docs/development-environment/starting-up-your-development-environment) \ No newline at end of file diff --git a/docs/content/docs/2.getting-started/2.add-spin-to-an-existing-project.md b/docs/content/docs/2.getting-started/3.add-spin-to-an-existing-project.md similarity index 82% rename from docs/content/docs/2.getting-started/2.add-spin-to-an-existing-project.md rename to docs/content/docs/2.getting-started/3.add-spin-to-an-existing-project.md index 5971b4dc..4b4d5fd7 100644 --- a/docs/content/docs/2.getting-started/2.add-spin-to-an-existing-project.md +++ b/docs/content/docs/2.getting-started/3.add-spin-to-an-existing-project.md @@ -35,10 +35,11 @@ spin init- -
- -Assuming you completed the prerequisites, the onboard wizard will take you through the process so you can get a local development environment with `spin up`. - -## Further Configuration -::note -Since we're using the [Laravel Basic](/docs/project-templates/laravel-basic) template, it's important to review the [project's README file](https://github.com/serversideup/spin-template-laravel-basic) for any additional steps required after creating the project. -:: - -Regardless of what template you're using, it's always important to review the template's README file for any additional steps required after creating the project. You may need to customize project URLs, environment variables, or other settings to get your project up and running. - -Once you have things configured, it could be possible to stop here and just have Spin manage your development environment -- but you won't get the full benefit of Spin. - -Spin is designed to keep your infrastructure 100% the same, no matter the environment. In the remainder of this guide, we'll show you how to deploy your project to a server. - -## Choosing a deployment strategy -Spin offers two deployment strategies: - -1. [`spin deploy` ](/docs/command-reference/deploy) (simple) -1. [GitHub Actions](/docs/advanced/zero-downtime-deployments-with-github-actions) (advanced) - -| | spin deploy | GitHub Actions | -|-------------------------|----------------------|-------------------------| -| Difficulty | Very Easy | Complex (it's automated CI/CD after all 🤪) | -| Team Size | Small teams | Small to very large teams | -| Zero-downtime Deployments | ✅ | ✅ | -| Automated Testing | ❌ | ✅ (you have to configure this though) | - - -### `spin deploy` (simple) -If you're a small team or bootstrapping a project to get it out the door as fast as possible, `spin deploy` might be your best friend. - -Without the headache of CI/CD, `spin deploy` will perform a zero-downtime deployment from your local machine to your server directly over SSH. There are no requirements for having a CI/CD pipeline or private Docker registries. - -Read more about `spin deploy` in the [command reference](/docs/command-reference/deploy). - -### GitHub Actions (advanced) -For GitHub Actions, we created an entire guide on how to achieve zero-downtime deployments with GitHub Actions. This is a more advanced strategy, but it's worth it if you're looking to automate your deployments. - -[Learn more about GitHub Actions deployments →](/docs/advanced/zero-downtime-deployments-with-github-actions) - -## Deploying to a server -Although it is possible to just use Spin for local development only, you'll get the full benefit of Spin when you use it to deploy your application to a server. - -Use the guide below to learn how to get your servers ready for a Spin deployment: - -[Prepare Your Servers for Spin →](/docs/getting-started/preparing-your-servers-for-spin) \ No newline at end of file diff --git a/docs/content/docs/2.getting-started/3.preparing-your-servers-for-spin.md b/docs/content/docs/2.getting-started/3.preparing-your-servers-for-spin.md deleted file mode 100644 index 241542b0..00000000 --- a/docs/content/docs/2.getting-started/3.preparing-your-servers-for-spin.md +++ /dev/null @@ -1,278 +0,0 @@ ---- -head.title: 'Preparing Your Servers For Spin - Spin by Server Side Up' -title: 'Preparing Your Servers For Spin' -description: 'Learn how to get your server ready for Spin deployment.' -layout: docs ---- - -# Preparing your server -::lead-p -Spin gives you the power to choose any host that you want. Although the responsibility is on your shoulders to get a server set up, Spin makes it very easy to get this accomplished. -:: - -## Choose a host -We've run [VPS Benchmarks against a number of hosts](https://521dimensions.notion.site/VPS-Benchmarks-for-Self-hosters-c6eca7c5f16d4bb8aeb989174fc58ffe?pvs=4) and have found the following hosts to have great value. The links below are referral links, meaning we get a small kickback if you sign up -- but this doesn't affect our recommendations. - -### Hetzner -Hetzner is a German-based company with data centers in the EU and the US. Their pricing is very competitive and they have incredible performance. - -With the link below, they offer €20 (~$21 USD) credits free which can get you a server for a few months. - -[Sign Up with Hetzner →](https://hetzner.cloud/?ref=lhLUIrkdUPhl) - -### Vultr -Vultr is a US-based company that has a great reputation for performance and value. They have a wide range of data centers around the world and a great API for automation. - -With the link below, they are offering $100 in credits -- which can get you quite a bit for a few months. - -[Sign Up with Vultr →](https://www.vultr.com/?ref=9627777-8H) - -### Digital Ocean -Digital Ocean is a US-based company that has data centers all around the world. Although their performance generally lacks compared to other providers, there are so many resources that natively support their offerings. - -With the link below, they are offering $200 in credits over 60 days. - -[Sign Up with Digital Ocean →](https://m.do.co/c/f3bad4b927ca) - -### Any other host -Spin is host-agnostic, meaning you can run Spin anywhere. If you have a preferred host, you can use them as well. Just make sure that your host meets the following requirements below. - -## Recommended Server Specs -::note -It is best to run `spin provision` against a **brand new server** with a fresh installation of Ubuntu 22.04 or newer. This will ensure that the server is in a known state and that the configuration will work as expected. -:: - -Hardware specs largely depend on your project, but even for simple apps, we recommend the following: - -- **CPU**: 1 CPU core -- **RAM**: 1GB -- **Storage**: >25GB SSD -- **Architecture**: x86_64 (64-bit) [[request ARM64 support](https://github.com/serversideup/spin/discussions/9)] -- **Operating System**: Ubuntu 22.04 LTS or newer -- **Snapshots/Backups**: Highly recommended -- **Firewall**: Configured to allow SSH and HTTPS traffic (22/tcp, 80/tcp, 443/tcp) -- **Access**: Root SSH access - -## Prepare your DNS -Once you have a server running with the host of your choice, it's recommended to configure your DNS to have two A records created pointing to the IP address of your server. - -Two records should be created: - -1. Application Domain Name (example: `myapp.example.com`) -2. Server Hostname (example: `server01.example.com`) - -::responsive-image ---- -src: /images/docs/getting-started/server-dns.png -alt: 'Configure your DNS' -maxWidth: 500 ---- -:: - -## Validate your SSH connection -Before you start, make sure you can SSH into your server **using an SSH key pair**. Many hosts do this by default, but you need to follow your hosts instructions for adding a trusted public key that can connect to your server. If you need help generating an SSH key, you can follow our guide on [Generating a Secure SSH Key](/docs/advanced/generating-a-secure-ssh-key). - - You can do this by running the following command: - -::note -We're assuming your host provisions their Ubuntu images as `root` as the default user. Use whatever standard your host uses, just as long as it has root access. -:: - -::code-panel ---- -label: "SSH into your server" ---- -```bash -ssh root@myserver01.example.com -``` -:: - -## Ensure your server is up to date -On your server, it's good practice to ensure everything is updated. Run this command below to update all packages on your server. Restarting the server is a good idea too to ensure everything is up to date. - -::code-panel ---- -label: "Update your server" ---- -```bash -apt -y update && apt -y upgrade && apt -y autoremove && apt -y autoclean && reboot -``` -:: - -## Configure server inventory and settings -::note -If your files are encrypted, you need to use the [`spin vault edit`](/docs/command-reference/vault) command to edit the file. This will decrypt the file, open it in your default editor, and then re-encrypt it when you save and close the file. -:: -Assuming you've already ran [`spin new`](/docs/command-reference/new) or [`spin init`](/docs/command-reference/init) in your project, there are two files that will need to be configured: -- `.spin-inventory.ini` -- `.spin.yml` - -#### Inventory -We call the list of our servers "inventory". This follows the [Ansible Inventory format](https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html). For example, if you wanted to add `server01.example.com` as the production server, we would configure our file to look like this and add this server to go underneath the `production_manager_servers` group: - -::note -Be sure to use your **server's hostname** (NOT your application's **domain name**) in the inventory file. This will ensure we have a dedicated DNS entry for managing your server. -:: - -::code-panel ---- -label: ".spin-inventory.ini: Add `server01.example.com` to Production" ---- -```ini -#################### -# Host Types -#################### - -[production_manager_servers] -server01.example.com - -[staging_manager_servers] -# server02.example.com - -#################### -# Swarm Roles -#################### -[swarm_managers:children] -production_manager_servers -staging_manager_servers - -#################### -# Environment -#################### -[production:children] -production_manager_servers - -[staging:children] -staging_manager_servers - -[all_servers:children] -production -staging -``` -:: - -## Configure server settings -In the `.spin.yml` file, you will find many other settings. These are required for you to change so you can connect to your server. - -#### 👉 Required to be changed -::note -**If you intend to use GitHub Actions**, we strongly recommend creating a dedicated SSH key pair for a "deploy" user (instead of using your own login, like `bob`). - -[Learn how to create a dedicated "deploy" SSH key pair →](/docs/advanced/generating-a-secure-ssh-key#generating-a-deployment-key) -:: - -| Key | Description | -|-----|---| -| `server_contact` | Change this to a valid email. **If you're using our Traefik templates**, you'll also need to change the `letsencryptresolver.acme.email` key under the `.infrastructure/conf/traefik/prod/traefik.yml` file. | -| `docker_user.authorized_ssh_keys` | OPTIONAL: Use this only if you're having something like GItHub Actions connect as the Docker User. This must be the **public key** of the your [DEPLOY user SSH keypair that you generated](/docs/advanced/generating-a-secure-ssh-key#generating-a-deployment-key). -| `users.username` | Set this to a username that you'll remember. Be sure to not use any weird characters. It might be in your best interest to match the username of your local machine. You can find this by running `whoami` in a new terminal.| -| `users.password` | Set this to the secure hash of the password you'd like to use. All users will be prompted to change on first login. Use [`spin mkpasswd`](/docs/command-reference/mkpasswd) to quickly generate a hash.| -| `users.username.authorized_ssh_keys` | Set this to **your USER _public_ SSH key value**. ⚠️ The key pair must be accessible under `~/.ssh` on your host. Most of the time the file ends in `*.pub`.| - - -::code-panel ---- -label: ".spin.yml" ---- -```yml ---- -########################################### -# Basic Server Configuration -########################################### -server_timezone: "Etc/UTC" -server_contact: changeme@example.com # 👈 Change this - -# SSH -ssh_port: "22" - -## Email Notifications -postfix_hostname: "{{ inventory_hostname }}" # ✅ Set automatically - -## Set variables below to enable external SMTP relay -# postfix_relayhost: "smtp.example.com" -# postfix_relayhost_port: "587" -# postfix_relayhost_username: "myusername" -# postfix_relayhost_password: "mysupersecretpassword" - -############################################################## -# Deploy User -############################################################## -docker_user: - username: deploy - uid: 9999 - group: deploy - secondary_groups: "docker" - gid: 9999 - ## Uncomment to set authorized SSH keys for the docker user. - # authorized_ssh_keys: - # - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKNJGtd7a4DBHsQi7HGrC5xz0eAEFHZ3Ogh3FEFI2345 deploy" # 👈 Change this - # - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFRfXxUZ8q9vHRcQZ6tLb0KwGHu8xjQHfYopZKLmnopQ anotherfake@key" - -############################################################## -# Users -############################################################## - -### Use the template below to set users and their authorized keys -## Passwords must be set with an encrypted hash. To do this, see the Ansible FAQ. -## Your best bet is probably using the `mkpasswd` on a Linux machine. -## https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-encrypted-passwords-for-the-user-module - -users: - - username: alice # 👈 Change this - name: Alice Smith # 👈 Change this - state: present - groups: ['adm','sudo'] - password: "$6$mysecretsalt$qJbapG68nyRab3gxvKWPUcs2g3t0oMHSHMnSKecYNpSi3CuZm.GbBqXO8BE6EI6P1JUefhA0qvD7b5LSh./PU1" # 👈 Change this - shell: "/bin/bash" - authorized_keys: - - public_key: "ssh-ed25519 AAAAC3NzaC1lmyfakeublickeyMVIzwQXBzxxD9b8Erd1FKVvu alice" # 👈 Change this - -# - username: bob -# name: Bob Smith -# state: present -# password: "$6$mysecretsalt$qJbapG68nyRab3gxvKWPUcs2g3t0oMHSHMnSKecYNpSi3CuZm.GbBqXO8BE6EI6P1JUefhA0qvD7b5LSh./PU1" -# groups: ['adm','sudo'] -# shell: "/bin/bash" -# authorized_keys: -# - public_key: "ssh-ed25519 AAAAC3NzaC1anotherfakekeyIMVIzwQXBzxxD9b8Erd1FKVvu bob" -``` -:: - -## Run `spin provison` -Once you have `.spin.yml` and `.spin-inventory.ini` configure, you're ready to provision your server(s). - -::note -Notice how we're using `--user root` in the command below. This is because most hosts provision `root` as the default user. - -By default `spin provision` will attempt to connect over SSH using the username on your workstation (how SSH works by default). Since your server doesn't come with your username already created, we need to connect as `root` on our first provision so Spin can configure the accounts configured in `.spin.yml`. -:: - -::code-panel ---- -label: "Provision your server(s)" ---- -```bash -spin provision --user root -``` -:: - -This process will automatically download [our Ansible collection](https://github.com/serversideup/ansible-collection-spin) and apply the changes on your server. - -## Confirm everything works -To confirm everything works as expected, try to SSH into your server using the username you created before. You will be prompted to change your password to a new password as soon as you login. - -::code-panel ---- -label: "Connect to your server via SSH" ---- -```bash -ssh myuser@server01.example.com -``` -:: - -If you get a connection, you should be ready to receive deployments to Docker Swarm via SSH 🥳 - -## Next Steps -If you're using the `spin deploy` deployment strategy, then take a look at our guide on how to run a simple deployment. - -[Deploy Your Project with `spin deploy` →](/docs/getting-started/run-a-simple-deployment) \ No newline at end of file diff --git a/docs/content/docs/2.getting-started/4.run-a-simple-deployment.md b/docs/content/docs/2.getting-started/4.run-a-simple-deployment.md deleted file mode 100644 index 897d193a..00000000 --- a/docs/content/docs/2.getting-started/4.run-a-simple-deployment.md +++ /dev/null @@ -1,64 +0,0 @@ ---- -head.title: 'Run a Simple Deployment with Spin - Spin by Server Side Up' -title: 'Run a Simple Deployment with Spin' -description: 'Learn how to get your server ready for Spin deployment.' -layout: docs ---- - -# Deploying your application with Spin -::lead-p -This guide is a continuation of the "Getting Started" section of the Spin documentation. In this section, we assumme [created a project with Spin](/docs/getting-started/create-a-new-project-with-spin), and you want to use the [`spin deploy`](/docs/getting-started/create-a-new-project-with-spin#choosing-a-deployment-strategy) deployment strategy. -:: - -## Prerequisites -- Your [project has been created with Spin](/docs/getting-started/create-a-new-project-with-spin) or [you added Spin to your existing project](/docs/getting-started/add-spin-to-an-existing-project) -- Your [server has been provisioned with Spin](/docs/getting-started/preparing-your-servers-for-spin) -- You've [completed any additional steps for your project template](/docs/getting-started/create-a-new-project-with-spin#further-configuration), defined by its README - -## Running your deployment -Once you have the prerequisites in place, you can run the `spin deploy` command to deploy your application to your server. - -::code-panel ---- -label: Deploy your application with Spin ---- -```bash -spin deploy+ +
+ +## Prerequisites +- Docker is installed and running. +- Spin is installed to your system or to your project (via composer or as a node dependency). + +## Ensure your application dependencies are installed +Before you can bring up your development environment, you need to ensure your application dependencies are installed. + +::note +If you just ran `spin new` to create a project, the application dependencies will already be installed. You can skip this step. +:: + +::code-panel +--- +label: Install dependencies (this depends on your project) +--- +```bash +# PHP dependencies +spin run php composer install + +# Node dependencies +spin run node yarn install +``` +:: + +## Bring up your development environment +Once your dependencies are installed, you can bring up your development environment with the following command: + +::note +Make sure to run this command from your project directory. +:: + +::code-panel +--- +label: Bring up your development environment +--- +```bash +spin up +``` +:: + +::note +To stop your development environment, press `Ctrl+C`. +:: + +Since Spin is running Docker Compose, you can also pass any argument to the `up` command. For example, `spin up -d` will start your development environment in detached mode. See the full documentation for [spin up](/docs/command-reference/up) for more information. + +## Accessing your development environment +In order to access your development environment, review the README of the template you're using. Each template has different instructions on how to access the services. diff --git a/docs/content/docs/3.development-environment/2.running-commands-in-development.md b/docs/content/docs/3.development-environment/2.running-commands-in-development.md new file mode 100644 index 00000000..f34d9623 --- /dev/null +++ b/docs/content/docs/3.development-environment/2.running-commands-in-development.md @@ -0,0 +1,51 @@ +--- +head.title: 'Running Commands in Development - Spin by Server Side Up' +title: 'Running Commands in Development' +description: 'Learn how to run commands in your development environment with Spin.' +layout: docs +canonical: https://serversideup.net/open-source/spin/docs/development-environment/running-commands-in-development +--- + +# Running Commands in Development +::lead-p +Spin makes it easy to run commands in your development environment by following the Docker Compose CLI syntax. +:: + +## How to run commands in development +You have two options to run commands in your development environment: + +1. [`spin exec`](/docs/command-reference/exec) - This executes commands in an EXISTING container (and requires that service to be already running with `spin up`). +2. [`spin run`](/docs/command-reference/run) - This executes commands in a NEW container, then exits. + +For example, let's say you want to run `composer install` in your development environment for Laravel, you would use the following command: + +::note +If you have `spin up` running in a terminal window, you will need to run the `spin run` or `spin exec` command in a new terminal window from your project directory. +:: + +::code-panel +--- +label: Run a command in a new container +--- +```bash +# Usage: spin run