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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐳 docker image and deploy script #84

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

🐳 docker image and deploy script #84

wants to merge 10 commits into from

Conversation

mrharpo
Copy link
Contributor

@mrharpo mrharpo commented Dec 20, 2022

Docker

Added dockerfile, based on ruby:3.1

  • Copy Gemfile and Gemfile.lock
  • Run bundle Install
  • CMD: bundle exec cap aws deploy

./deploy

Docker based shortcut script

Usage

./deploy COMMAND [ARGS]

Requires local vars to be exported in the current session, e.g:

export BRANCH=42-fixes-all-bugs

Also requires the SSH_KEY to be available somewhere within $PWD, so it can be mounted into the container.

Commands

build

Build the docker image

deploy

Run the deployer

  • Passes local ENV_VARS to docker for:
    • BRANCH
    • APP_NAME
    • REPO_URL
    • SSH_HOST
    • SSH_KEY
  • exported ENV_VARS can be overwritten on the command line:
    • BRANCH=my-fancy-branch ./deploy deploy

Other usage

Enter the deployer into a bash session:

./deploy deploy bash

@mrharpo mrharpo added the feature request 🧚 New feature request label Dec 20, 2022
@mrharpo mrharpo self-assigned this Dec 20, 2022
@@ -1,6 +1,4 @@
# For more options, see http://capistranorb.com/documentation/getting-started/configuration/#
# config valid only for current version of Capistrano
lock '3.3.5'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this getting in the way? Seems like removing it opens up a new risk of incompatibility between the Capistrano version and our config

Copy link
Contributor Author

@mrharpo mrharpo May 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added with e75758b

Upgrades to ruby3.2, capistrano 3.18

Seems to be working fine with the upgraded capistrano version, so I'm fine continuing with the latest for now, until it becomes a problem, when we can lock it.

click.echo(f"Branch: { branch }")
cmd = f"""docker run -it -v {realpath('')}:/root/ {DOCKER_IMAGE}"""

sub_run(cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrharpo how does context and branch inform the docker run command?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot about this file. This was a secondary attempt after the ./deploy script, which is what I've been using to deploy things.

Not sure why I would prefer this over the env var approach. We can probably delete this file, since the regular bash version is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request 🧚 New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants