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

Code cleanup + Docker + support for few new arguments #8

Merged
merged 21 commits into from
Jan 19, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6345f94
Help datacenter info updated to match the working one.
pozgo Dec 23, 2014
2c801b3
Added $USER on finishing the script for easier login.
pozgo Dec 23, 2014
f22061e
Extended time "waiting for boot"
pozgo Jan 15, 2015
90a2bfa
Unified arg commands
pozgo Jan 15, 2015
4824e3e
Added DATA partition
pozgo Jan 15, 2015
5134d4e
grub fix for boot - first attempt
pozgo Jan 15, 2015
a9feae7
Added Data partition size argument.
pozgo Jan 17, 2015
277ee85
Added --data-size arg. redesigned options.
pozgo Jan 17, 2015
318044c
linode_api_macro: formatting
ryzy Jan 17, 2015
4d21613
chore: verifying installed command: more terse version
ryzy Jan 17, 2015
8cbeaa4
chore: help re-organised
ryzy Jan 17, 2015
07164d8
log/error function introduced to improve logging
ryzy Jan 18, 2015
e171942
fix: arguments were not interpreted correctly, fix the issue with 'se…
ryzy Jan 18, 2015
c9ca06f
#7 feat: --cloud-config param introduced, where cloud config have to …
ryzy Jan 18, 2015
f938997
README update: params update, example update
ryzy Jan 18, 2015
bc82408
chore: linodeapi, linode_api_macro no longer needs to be installed so…
ryzy Jan 18, 2015
99286fc
chore: list plans/datacenter moved to functions, improved validation …
ryzy Jan 18, 2015
7b92f1c
Fixes #7 Docker: working version
ryzy Jan 18, 2015
9c0e8a7
README revise
ryzy Jan 18, 2015
d7ad599
copyright notes added to borrowed scripts
ryzy Jan 18, 2015
95bfc7e
feat: --extra-disk-size, --swap-disk-size options + minor fixes/impro…
ryzy Jan 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#
# million12/linode-coreos-api
#

FROM centos:centos7
MAINTAINER Przemyslaw Ozgo linux@ozgo.info, Marcin Ryzycki marcin@m12.io

ENV GITHUB_KEY key
ENV LINODE_KEY key

RUN \
yum install -y epel-release && \
yum update -y && \
yum install -y epel-release && \
yum install -y git pwgen sshpass openssh sudo jq && \
yum clean all

ADD . /tmp/linodeapi/
ADD . /usr/local/share/

RUN \
mv /tmp/linodeapi/linode /usr/local/bin/linode && \
mv /tmp/linodeapi/linodeapi /usr/local/bin/linodeapi && \
mv /tmp/linodeapi/linode_api_macro /etc/linode_api_macro && \
rm -rf /tmp/linodeapi
chmod +x /usr/local/share/linode && \
ln -s /usr/local/share/linode /usr/local/bin/linode

ENV TERM xterm-256color

ENTRYPOINT ["/usr/local/bin/linode"]
CMD ["--help"]
66 changes: 31 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
# Linode bash API for CoreOS deployment
# CoreOS deployment on Linode

With this work you can easily deploy [CoreOS](https://coreos.com/) on [Linode](https://www.linode.com/) infrastructure. CoreOS is so far not available on Linode - with this script you can easily and quickly deploy CoreOS with your own cloud-config.
With this work you can easily deploy [CoreOS](https://coreos.com/) on [Linode](https://www.linode.com/). As for today (Jan 2015) CoreOS is not available on Linode. With this work you can easily and quickly deploy CoreOS with your own cloud-config.

## Installation (with Docker)

```
docker pull million12/linode-coreos-api
```
This is the recommended - and the simplest, if you already familiar with Docker - way to use this tool. If you have you Docker daemon running, pull the image:
`docker pull million12/linode-coreos-api`

Then simply run:
`docker run --rm -t --env=GITHUB_KEY=$GITHUB_KEY --env=LINODE_KEY=$LINODE_KEY million12/linode-coreos-api`
`docker run -t --env="LINODE_KEY=$LINODE_KEY" --rm million12/linode-coreos-api`

To make it even easier, add an alias to your `.bashrc`, `.bash_profile` or `.profile` file:
To make it even easier, add an alias to your `.bash_profile`:
``` bash
export GITHUB_KEY=yourkey
export LINODE_KEY=yourkey
alias linode='docker run --rm -t --env=GITHUB_KEY=$GITHUB_KEY --env=LINODE_KEY=$LINODE_KEY million12/linode-coreos-api'
alias linode='docker run -t --env="LINODE_KEY=$LINODE_KEY" --rm million12/linode-coreos-api'
```

With this you can run simply `linode --help` or `linode --list_plans`. The Docker image has `ENTRYPOINT` set to `linode` script, therefore any extra param will be passed directly to `linode` script.
With this you can run simply `linode --help` or `linode --list-plans`. The Docker image has `ENTRYPOINT` set to `linode` script, therefore any extra param will be passed directly to `linode` script.

## Installation (manual)
## Installation (manual, the old way)

You will need to have few programs installed on your machine to be able to use this api. The list contains:
`curl`
`pwgen`
`sshpass`
`sudo`
`jq`
* `curl`
* `pwgen`
* `sudo`
* `jq`
* `sshpass`
Mac Users install:
`brew install https://raw.github.com/eugeneoden/homebrew/eca9de1/Library/Formula/sshpass.rb`

You can install all above using `yum install NAME` (RHEL) or `apt-get install NAME` (Fedora, Debian, Ubuntu) or `brew install NAME` (OSX).

Once you have them all, run `./linode`. It will download required LinodeAPI macros. You can also symlink `linode` to your PATH to make it easily available everywhere.
Once you have them all, run `./linode`. You can also symlink `linode` tool to your `$PATH` to make it available everywhere.

## Environment variables
You need environmental variables with keys for Linode API access and GitHub for accessing your cloud-config file (which might be inside a private repository). Note: in the future we would like See Linode/GitHub documentation.
[Linode API Key documentation](https://www.linode.com/api)
[GitHub API Key documentation](https://developer.github.com/v3/oauth_authorizations/)

Variables:
`GITHUB_KEY=yourkey`
`LINODE_KEY=yourkey`

you can easily export them by running in shell:
`export GITHUB_KEY=yourkey`
You can easily export them by running in shell:
`export LINODE_KEY=yourkey`

## Usage
Expand All @@ -51,34 +51,30 @@ Options:

| Command | Details | Importance |
|:--------|---------|:----------:|
|`--node_name`|Name for your node | **Required** |
|`--node_plan`|Plan of your choice. If not provided system will show you all available options. | **Required** |
|`--datacenter`|Datacenter in which your node should be deployed. If not provided system will show you all available options. | **Required** |
|`--config_local`|`yaml` config file path from local drive (If not provided, GitHub file need to be provided) | **Semi-Required** |
|`--config_github`|GitHub `yaml` file link.(If not provided `--config_local` need to be provided.). |**Semi-Required**|
|`--token`|ETCD Token Key for fleet deployment. If not provided program will generate one. |**Optional**|
|`--cloud-config`|***Content*** of the user-data config. You must provide it using this trick:<br />`--cloud-config="$(< path/to/your/cloud-config.yaml)` | **Required** |
|`--node-name`|Name for your node | **Required** |
|`--node-plan`|Plan of your choice. If not provided system will show you all available options. | Optional<br />Default: 1<br />(1CPU, 1GB RAM) |
|`--datacenter`|Datacenter in which your node should be deployed. If not provided system will show you all available options. | Optional<br />Default: 2<br />(Dallas, TX) |
|`--token`|ETCD Token Key for fleet deployment. If not provided program will generate one. |Optional|
|`--swap-disk-size`|Swap size in MB. Set to 0 to disable. Must be an integer value. That will decrease the CoreOS system partition size by provided amount. |Optional<br />Default: 2048|
|`--extra-disk-size`|Extra partition (raw) size in MB to create next to default system partition. Must be an integer value. That will decrease the CoreOS system partition size by provided amount. |Optional<br />Default: 0|

Quick lists:
Linode lists:

| Command | Details |
|---------|---------|
|`--list_plans`|List all available plans|
|`--list_datacenters`|List all available datacenters|

### Examples
Deploy node with your localfile `yaml` config and token for hooking up with already deployed fleet.

`linode --node_name elasticsearch --node_plan 2 --datacenter 7 --token f0f727cdc75b55aa12de9085d7f444a1 --config_local ~/my_config.yaml`

Deploy node with GitHub `yaml` config file and no ETCD token. (no fleet will be used in this exapmple)

`linode --node_name logstash --node_plan 1 --datacenter 7 --config_github https://raw.githubusercontent.com/million12/linodeapi/master/cloud-config.yaml`
Deploy node with `cloud-config.yaml` config:
`linode --node-name=test1 --node-plan=1 --datacenter=3 --cloud-config="$(< path/to/cloud-config.yaml)"`


# Author(s)

Author: Przemyslaw Ozgo (<linux@ozgo.info>)
Note: this work is strongly influenced by [rwky/Linode-Bash-API](https://github.com/rwky/Linode-Bash-API).
Note: this work uses Linode API originally developed by [rwky/Linode-Bash-API](https://github.com/rwky/Linode-Bash-API).

---

Expand Down
Loading