candilano v0.14.1

🍬 A multi-server deployment tool for Crystal apps inspired by Capistrano

GitHub release

🍬 Candilano

A multi-server deployment tool, inspired by Capistrano, the deployment tool for Ruby.

This library is tailored to web applications and can be used to deploy your app to one or multiple servers in a consistent and configureable way. It supports all web frameworks available for Crystal. The configuration is YAML based and is inspired by Ansible.

Be aware this is still under development and can break things.

Table of Contents

Installation

  1. Add the dependency to your shard.yml:
dependencies:
  candilano:
    github: gem-shards/candilano
  1. Run shards install

  2. Add the following lines to your targets in shards.yml:

targets:
  can:
    main: lib/candilano/src/candilano.cr
  1. Run shards build can to build candilano

Usage

Init

Run init script in the projects root path:

./bin/can init

It will create a deploy directory with two yaml files for sandbox and production use. You can modify the files to your liking.

Check

Run the check command to check if you can connect to your servers and see if it has all the permissions are set to start a deploy.

./bin/can check production

Deploy

With the deploy command you will execute a deployment.

./bin/can deploy production

Rollback

With the rollback command you will execute a deployment.

./bin/can rollback production

Restart

With the restart command you can restart your running application.

./bin/can restart production

Configuration

If you run the init command it will generate the following configuration:

---
  app_name: 'your-app-name'
  repo_url: 'git@github:repo.git'
  branch: 'master'
  deploy_to: '/location/to/deploy'
  keep_releases: 5
  restart_command: 'service your-app-name restart'

  # Optionally, set a migrate command for database migrations
  # It will execute on the 'db' role only when it's present.
  # migrate_command: 'db migrate'

  ssh:
    user: user
    password: password
    port: 22
    key: '~/.ssh/id_rsa'
    forward_agent: true

  # linked_files:
  #   - 'config/settings.yml'

  # linked_directories:
  #  - 'log'
  #  - 'tmp'

  servers:
    - host: 127.0.0.1
      roles:
        - web
        - db
  # - host: 127.0.0.1
  #   roles:
  #     - web

  # hooks:
  #   before:
  #     - command: 'free'
  #       task_group: 'rollback:get_previous_version'
  #       target: 'remote'
  #       on_role: 'db'
  #   after:
  #     - command: 'free'
  #       task_group: 'rollback:get_previous_version'
  #       target: 'local'

Development

This library is under development. It is already used in production by myself. I still want to implement the following features:

  • Show more debug info if command fails
  • Ansible like variables and checks
  • Dry-run support
  • Ability to write your own 'programs'

Contributing

  1. Fork it (https://github.com/gem-shards/candilano/fork)
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors

Repository

candilano

Owner
Statistic
  • 6
  • 0
  • 0
  • 0
  • 1
  • over 2 years ago
  • July 2, 2020
License

MIT License

Links
Synced at

Sun, 22 Dec 2024 17:01:51 GMT

Languages