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

[Elao - App] Generate ssh targets from release hosts #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

maximecolin
Copy link
Member

In .manala.yaml file (same existing deploy config):

releases:

    # Production
    - &release
        mode: production
        deploy_hosts:
            - ssh_host: app-01.foobar.prod.elao.run
            - ssh_host: app-02.foobar.prod.elao.run
        # ...

    # Staging
    - << : *release
      mode: staging
      deploy_hosts:
          - ssh_host: app-01.foobar.staging.elao.run
      # ...

will generate in Makefile :

#######
# SSH #
#######

## Ssh to production 01 server
ssh@production-01: SHELL := $(or $(DOCKER_SHELL),$(SHELL))
ssh@production-01:
	ssh app-01.foobar.prod.elao.run

## Ssh to production 02 server
ssh@production-02: SHELL := $(or $(DOCKER_SHELL),$(SHELL))
ssh@production-02:
	ssh app-02.foobar.prod.elao.run

## Ssh to staging server
ssh@staging: SHELL := $(or $(DOCKER_SHELL),$(SHELL))
ssh@staging:
	ssh app.foobar.staging.elao.run

@maximecolin maximecolin self-assigned this Apr 21, 2021
@maximecolin maximecolin requested a review from nervo April 21, 2021 15:09
@maximecolin maximecolin added the enhancement New feature or request label Apr 21, 2021
@maximecolin
Copy link
Member Author

Problem:

releases:

    # Production
    - &release
        mode: production
        ref: master
        deploy_hosts:
            - ssh_host: app-01.foobar.prod.elao.run
    - << : *release
      mode: production
      ref: preprod
      deploy_hosts:
          - ssh_host: app-01.foobar.preprod.elao.run

will generate:

## Ssh to production server
ssh@production: SHELL := $(or $(DOCKER_SHELL),$(SHELL))
ssh@production:
	ssh app-01.foobar.prod.elao.run

## Ssh to production server
ssh@production: SHELL := $(or $(DOCKER_SHELL),$(SHELL))
ssh@production:
	ssh app-01.foobar.preprod.elao.run

Maybe we should name releases like this:

releases:

    # Production
    production: &release
        mode: production
        ref: master
        deploy_hosts:
            - ssh_host: app-01.foobar.prod.elao.run
    preprod: 
      << : *release
      mode: production
      ref: preprod
      deploy_hosts:
          - ssh_host: app-01.foobar.preprod.elao.run

@maximecolin
Copy link
Member Author

@nervo Du coup le problème se pose également sur les make release@xxx et make deploy@xxx. Si dans la config on a deux releases en mode production, ça va générer 2 make release@production et 2 deploy@production.

On s'en est bien accommodé jusque là. Donc on peut garder la PR telle quelle je pense. Ça posera pas plus de soucis que ce qui existe déjà.

@ogizanagi
Copy link
Member

ogizanagi commented Jun 30, 2021

@maximecolin : Un soucis avec la proposition:

releases:

    # Production
    production: &release
        mode: production
        ref: master
        deploy_hosts:
            - ssh_host: app-01.foobar.prod.elao.run
    preprod: 
      << : *release
      mode: production
      ref: preprod
      deploy_hosts:
          - ssh_host: app-01.foobar.preprod.elao.run

C'est que tu peux avoir plusieurs apps à release/deploy dans un mm projet en production:

releases:

  - &release_api
    app: api
    mode: production
    deploy_hosts:
        - ssh_host: app-01.foobar.prod.elao.run
    deploy_dir: /srv/app/api

  - &release_admin
    app: admin
    mode: production
    deploy_hosts:
        - ssh_host: app-01.foobar.prod.elao.run
    deploy_dir: /srv/app/admin

Donc si ta clé doit représenter ta cible de déploiement, ça ne fonctionne pas.

Quel est le cas d'usage de:

    - << : *release
      mode: production
      ref: preprod
      deploy_hosts:
          - ssh_host: app-01.foobar.preprod.elao.run

vs:

    - << : *release
      mode: preprod
      deploy_hosts:
          - ssh_host: app-01.foobar.preprod.elao.run

au juste ?

@ogizanagi
Copy link
Member

QUID de cette PR ?

@nervo
Copy link
Member

nervo commented Sep 9, 2022

il faudrait reprendre à tête reposée :)

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

Successfully merging this pull request may close these issues.

None yet

3 participants