Giter VIP home page Giter VIP logo

rancher-export's Introduction

rancher-export

A script to export docker-compose and rancher-compose configurations via the Rancher API v1. NOTE that only v1 is supported at the moment, and export is the primary goal; import functionality is very basic.

configuration

create an .env file in this directory, following this format:

CATTLE_URL=https://the.rancher.url/v1
CATTLE_ACCESS_KEY=<your_key>
CATTLE_SECRET_KEY=<your_secret>

The keys are generated via Rancher UI -> API menu.

An "environment" key limits access to the Rancher environment you're currently signed in to. An "account" key gives access to all the environments you have access to. The script will only export environments visible to it.

running

npm start. The configs will be saved into an export directory in the current working dir.

the export directory must be manually removed before running this script again.

NOTE any 'standalone' docker-compose projects created outside of Rancher (i.e. by running docker-compose directly on a host) will be exported with empty docker-compose and rancher-compose files. Remove those directories.

You can compress this directory for archival by running tar -czvf export-$(date +%Y-%m-%d).tar.gz export

utilities

Prerequisite: rancher-compose. Download it from your Rancher instance.

WARNING: these tools are DANGEROUS and barely tested. Use at your own risk.

Create an .env.import file with the following format:

CATTLE_URL=
CATTLE_ACCESS_KEY=
CATTLE_SECRET_KEY=

These keys must be Rancher "Environment" keys (as opposed to "Account"). This file is kept separate from the .env file on purpose, for safety.

Note: API keys for all environments can be obtained by visiting https://myrancher.com/v1/apikeys and clicking the +Create button.

./remove-affinity.sh <environment_name> will remove the io.rancher.scheduler.affinity:host_label: keys from all .yml files in the target environment (directory). This is useful if the target hosts will not have the same labels as the source hosts.

./import.sh <environment_name> will import all stacks from a previously exported environment (under export in this directory) into the environment accessed by the above keys. It will name the stacks as per their directory names.

rancher-export's People

Contributors

ebr avatar emcniece avatar

Watchers

James Cloos avatar  avatar

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.