Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

"spin deploy": Allow deployments without CI/CD #75

Open
1 task
jaydrogers opened this issue Apr 5, 2024 Discussed in #61 · 3 comments
Open
1 task

"spin deploy": Allow deployments without CI/CD #75

jaydrogers opened this issue Apr 5, 2024 Discussed in #61 · 3 comments
Labels
鈿★笍 Enhancement Items that are new features requested to be added.

Comments

@jaydrogers
Copy link
Member

Discussed in #61

Originally posted by jaydrogers January 24, 2024

馃憠 Describe the problem

  • The current version of Spin requires using GitHub Actions or GitLab CI for deployment, adding more knowledge requirements to get started
  • Many users getting started are very confused on how to run deployments

馃懃 Problem evidence & reach

Some users have expressed interest in removing this requirement: https://discord.com/channels/910287105714954251/1195096786776359064

馃グ Describe the "impact" on users?

  • New users can deploy a server on their own very easily

馃弳 How to solve this problem

Solution Overview

We can reduce the knowledge requirements by allowing users to run spin provision (to configure and prepare their server for Docker), then spin deploy to locally deploy their image to their servers.

Spin Diagram

This proposed method eliminates a few headaches:

  • Users don't need to learn GitHub Actions or the deep inner workings on how a Docker Registry works
  • This configuration is a lot easier to debug since its working with systems directly in the user's control

[!NOTE]
This method is intended to be used for very simple set ups. For most environments, it will be recommended to use GitHub Actions or GitLab CI (or comparable) to deploy applications

Deployment Process

  1. Initialize Project (create files)
  2. Configure (ensure Spin configs are set)
  3. Build (ensure tag is set correctly, ensure env exists within application)
  4. Transfer (use docker image save: https://nickjanetakis.com/blog/docker-tip-97-save-and-load-docker-images-from-a-zip-file)
  5. Run docker stack deploy to initialize the transfer

馃挴 How do we validate the problem is solved?

  • Users can run spin provision (to configure their server) then spin deploy to deploy their stack
@jaydrogers jaydrogers added the 鈿★笍 Enhancement Items that are new features requested to be added. label Apr 5, 2024
@nckrtl
Copy link

nckrtl commented May 26, 2024

Hey Jay as I played this feature a bit already I was wondering what it would look like when running multiple applications on the same server. As you won't deploy generic services like traefik and redis with each application/project, would you have like a generic stack/project with stuff like traefik, redis etc, and then specific app stacks with php service(s) + appropriate traefik labels? Or would this be meant to deploy 1 app per server?

@nckrtl
Copy link

nckrtl commented May 30, 2024

Been doing some testing, and got it working with multiple swarm stacks. 1 stack for traefik, 1 for redis, and 1 with a laravel project. What's cool about the setup is that it's really easy to run multiple web projects on the same server. Perhaps I'm misunderstanding the current situation and this is already possible, but I couldn't see how.

A couple things I ran into:

  • A Dockerfile is needed when running spin deploy, while it won't be needed if your stack only consists of a treafik or redis service. So I created an empty Dockerfile that just uses a random image.
  • As I intended to only run traefik and redis on production and not locally I removed docker-compose.dev.yml. But the deploy command is throwing a warning that docker-compose.dev.yml is missing.
  • Also a docker-compose-prod.yml is needed, would be nice to just default to docker-compose.yml if there is not production yml.
  • You need to update the production server name in spin-inventory.ini to be unique across all stacks, because that name is being used to generate the stack name. Maybe it could be supported to be able to somewhere set the stack name, so you can always use spin deploy production instead if spin deploy production_<unique_tag>

Its also important to define the network as follows:

networks:
  web-public:
    external: true

Else the stacks won't be able to communicate with each other.

All things above are probably out of scope currently for this issue/feature, but it would be really cool to have proper support for multiple docker stacks.

@nckrtl
Copy link

nckrtl commented May 30, 2024

You can ignore my remarks, they don't really apply to the issue/feature in question. I'll create a separate feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
鈿★笍 Enhancement Items that are new features requested to be added.
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants