Coder Social home page Coder Social logo

philibea / scaleway-containers-deploy Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 3.0 5.93 MB

scaleway deploy container with registry and custom endpoint dns

License: MIT License

Dockerfile 1.17% Go 98.83%
docker dns container scaleway deploy github-actions

scaleway-containers-deploy's Introduction

Scaleway logo

The simplest way to deploy your app in Scaleway


Scaleway GitHub Action

Scaleway Containers Github Action is a Github Action plugin allowing Scaleway users to integrate Containers within their CI nicely.

โœ… Requirements

  • A Scaleway account. Sign up now if you don't have any account yet.

๐Ÿ“– Installation

  • Create an API key: how to generate your API token?

  • Setup a secret named SCW_SECRET_KEY & SCW_ACCESS_KEY within your repository Secrets section and set its value with output of the previous step.

  • Setup a Registry Actually only Scaleway Registry is available.

  • Setup a Containers Namespace SCW_CONTAINER_NAMESPACE_ID within your repository Secrets section and set its value with your Scaleway account namespace. This Namespace is used inside the same Region of your registry.

You can can setup this namespace with our cli scw containers namespace create command.

  • (optional) Setup a SCW_DNS_ZONE within your repository Secrets section and set its value with your Scaleway account DNS zone. How To add Custom Domains. In this automation process, we will use the DNS zone of your Scaleway account. Each zone will be based on the container name created and based on the tag of your Image. Your path registry is rg.fr-par.scw.cloud/test/images:latest, your container name tag will be latest and your DNS zone will be latest.${SCW_DNS_ZONE}.

๐Ÿ”Œ Usage

scw_access_key, scw_secret_key & scw_containers_namespace_id will always be necessary

simple deploy

input name value
type deploy (default value )
scw_registry rg.fr-par.scw.cloud/test/images:latest
scw_region fr-par (default value)
scw_container_port 80 (default value )
scw_memory_limit 256 (default value )
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy on Scaleway Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Deploy action
        id: deploy
        uses:  philibea/[email protected]
        with:
          type: deploy
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/test/testing:latest

simple teardown

input name value
type teardown
scw_registry rg.fr-par.scw.cloud/test/images:latest
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Teardown Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Teardown action
        id: teardown
        uses:  philibea/[email protected]
        with:
          type: teardown
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/test/testing:latest

deploy with environment variables and secrets

Note: The environment variables/secrets values can't contains commas nor equal signs.

input name value
type deploy (default value )
scw_registry rg.fr-par.scw.cloud/test/images:latest
scw_region fr-par (default value)
scw_container_port 80 (default value )
scw_memory_limit 256 (default value )
scw_environment_variables HELLO=WORLD,JOHN=DOE
scw_secrets HELLO=WORLD,JOHN=DOE
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy on Scaleway Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Deploy action
        id: deploy
        uses:  philibea/[email protected]
        with:
          type: deploy
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/test/testing:latest
          scw_environment_variables: HELLO=WORLD,JOHN=DOE
          scw_secrets: ${{ secrets.SECRETS }}

deploy to another region using an external registry

input name value
type deploy (default value )
scw_registry registry.hub.docker.com/library/nginx:latest
scw_region nl-ams
scw_container_port 80 (default value )
scw_memory_limit 256 (default value )
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy on Scaleway Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Deploy action
        id: deploy
        uses:  philibea/[email protected]
        with:
          type: deploy
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: registry.hub.docker.com/library/nginx:latest
          scw_region: nl-ams

dns deploy

input name value
type deploy
scw_registry rg.fr-par.scw.cloud/test/images:latest
scw_dns containers.test.fr

Actually, prefix of your dns will use the default value: "name of you created container" This created containers will be based on the tag name of the registry.

on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy on Scaleway Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Deploy action
        id: deploy
        uses:  philibea/[email protected]
        with:
          type: deploy
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/test/testing:latest
          scw_dns: containers.test.fr

dns teardown

input name value
type teardown
scw_registry rg.fr-par.scw.cloud/test/images:latest
scw_dns containers.test.fr
scw_dns_prefix (optional) testing
on: [push]

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Teardown Containers
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Scaleway Container Teardown action
        id: teardown
        uses:  philibea/[email protected]
        with:
          type: teardown
          scw_access_key:  ${{ secrets.ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/test/testing:latest
          scw_dns: containers.test.fr

dns deploy on root zone

if you want to deploy a container on your zone, you will need to control a new boolean variable root_zone

๐Ÿณ Docker

If you want to use this flow outside of Github Actions, you can use the Docker Image.

docker run -it --rm \
  -e INPUT_SCW_ACCESS_KEY=${SCW_ACCESS_KEY} \
  -e INPUT_SCW_SECRET_KEY=${SCW_SECRET_KEY} \
  -e INPUT_SCW_CONTAINERS_NAMESPACE_ID=${SCW_CONTAINERS_NAMESPACE_ID} \
  -e INPUT_SCW_REGISTRY=rg.fr-par.scw.cloud/test/testing:latest \
  -e INPUT_SCW_DNS=containers.test.fr \
  -e INPUT_TYPE=deploy \
  phiphi/scaleway-containers-deploy:latest

Gitlab

If you want to use this flow outside of Github Actions, you can use the Docker Image inside you gitlab-ci configuration. You can check an exemple in this directory here

scaleway-containers-deploy's People

Contributors

philibea avatar quiibz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scaleway-containers-deploy's Issues

Leak of env vars

Hi,

First of all, thank you for your work.

I just noticed that at the end of a deployment, all the environment variables present on Scaleway are leaked in the Github Action logs. Is it possible to hide this?

My conf :

      - name: StepName
        id: deploy
        uses: philibea/[email protected]
        with:
          type: deploy
          scw_access_key: ${{ secrets.SCW_ACCESS_KEY }}
          scw_secret_key: ${{ secrets.SCW_SECRET_KEY }}
          scw_containers_namespace_id: ${{ secrets.SCW_CONTAINERS_NAMESPACE_ID }}
          scw_registry: rg.fr-par.scw.cloud/xxxx/yyyy:staging
          scw_container_port: 3333

Example of leak in action logs :

waiting for namespace to be ready
Container Name:  staging
Container already exists and will be updated &{xxxx staging *** ready map[APP_KEY:xxxxCACHE_VIEWS:false DB_CONNECTION:mysql DRIVE_DISK:s3 HASH_DRIVER:bcrypt HOST:0.0.0.0 ....

Configuration options for autoscaling

Hi,
we are looking into vercel-style preview deployments on scaleway and it would be really cool to be able to configure some more scaling options through this action, particularly useful would be

  • min and max instance count
  • cpu
  • concurrent connections

would it be possible to make those configurable?

Environment variables not working

Hi i have tried adding environment variables to the github action but they dont show up in scaleway. Its the same for the secret environment variables

Example
scw_environment_variables: SOMEVARIABLE1=1234,SOMEVARIABLE2=12345

Github actions also show this warning (also for the secrets if they are added)
Unexpected input(s) 'scw_region', 'scw_environment_variables', valid inputs are ['entryPoint', 'args', 'type', 'scw_access_key', 'scw_secret_key', 'scw_containers_namespace_id', 'scw_registry', 'scw_container_port', 'scw_dns', 'scw_dns_prefix']

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.