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

Update docker instructions #295

Merged
merged 8 commits into from
Mar 1, 2017
Merged

Update docker instructions #295

merged 8 commits into from
Mar 1, 2017

Conversation

begriffs
Copy link
Contributor

Fixes #292 (I will subsequently open a pull request to update the Citus readme as well).

Tested the Docker installation instructions under Ubuntu 16.04 and CentOS 7.3.

@craigkerstiens craigkerstiens temporarily deployed to citus-doc-preview-pr-295 February 22, 2017 18:43 Inactive
@begriffs
Copy link
Contributor Author

Here you go, @samay-sharma, give it a try.

@craigkerstiens craigkerstiens temporarily deployed to citus-doc-preview-pr-295 February 22, 2017 18:52 Inactive

# Linux ONLY

curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could alternately link to the instructions in https://github.com/docker/compose/releases/latest

This has the advantage of not hardcoding a docker-compose version, but the disadvantage of being harder to follow than our reproducing the command here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's super annoying that we have to ask users to add a repo to their box (to download Engine) only to turn around and ask them to curl some binary into their path.

docker/compose#2235 is a request to add docker-compose to the repository. I have no clue why this isn't already the case, but dropping a reference here in order to register my displeasure with upstream.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spinned up a linux box and tried these steps. I ran into two separate issues.

(1) These steps assume that I'm running as root on my box. This isn't the case and the following instructions worked.

sudo curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

(2) Even after this, when I ran docker-compose -p citus up -d, I saw the following error message.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/json: dial unix /var/run/docker.sock: connect: permission denied

This was because I didn't run the Linux postinstall steps in here: https://docs.docker.com/engine/installation/linux/linux-postinstall/


**2. Start the Citus Cluster**

Citus uses docker-compose to run and connect containers holding the database master node, workers, and a persistent data volume. To create a local cluster download our docker-compose configuration file and run it

.. code-block:: bash

wget https://raw.githubusercontent.com/citusdata/docker/master/docker-compose.yml
curl -L https://raw.githubusercontent.com/citusdata/docker/master/docker-compose.yml > docker-compose.yml
docker-compose -p citus up -d
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After installing docker, I had to start docker before I was able to do docker-compose. Could we add a step to the instructions which tells users to do that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Come to think of it, when I tested on Ubuntu and CentOS the installer also started the daemon automatically. It's only the Mac installation that requires a start step. So I added a "Mac Only" step to the list.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super minor unrelated point for the note below (line 41).

If you have PostgreSQL running on your machine -> If you already have PostgreSQL running on your machine

@craigkerstiens craigkerstiens temporarily deployed to citus-doc-preview-pr-295 February 23, 2017 02:15 Inactive

open /Applications/Docker.app

* (Linux only) On most platforms the previous step will install docker-compose as well as Docker, but on Linux you'll need to install docker-compose manually by downloading the binary and putting it in your path:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small rewording.

On Linux, you need to manually install docker-compose (you can find the latest docker-compose version here). For this, you need to download the binary and put it in your path:


curl -sSL https://get.docker.com/ | sudo bash
sudo usermod -aG docker $USER && exec su -l $USER
sudo systemctl start docker
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my CentOS test Docker did not start automatically after non-root installation. Adding systemctrl start fixed that, and also causes no harm in Ubuntu where the service was already started.

The systemctl works for Linux distros that use systemd, which I think is recent versions of all major distros. @jasonmp85 does this seem like a good bet to you?

Copy link

@ozgune ozgune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@begriffs -- I had three higher level questions.

  1. When I look at the "Single-Machine Cluster" menu, it looks different and more involved than installation steps for other platforms. Could we make this uniform? (preferably keep Docker steps as they were before)?

https://citus-doc-preview-pr-295.herokuapp.com/installation/development.html

  1. How confident are we that curl, usermod, systemctl are going to reliably work across different Linux distros? -- don't know, just asking

  2. I remember @jasonmp85 saying that the Docker installation steps didn't work on Windows. Do we know whether Docker runs on Windows or not? (If it doesn't work on Windows, happy to just nix the windows part.)


# Linux ONLY

curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spinned up a linux box and tried these steps. I ran into two separate issues.

(1) These steps assume that I'm running as root on my box. This isn't the case and the following instructions worked.

sudo curl -L https://github.com/docker/compose/releases/download/1.11.1/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

(2) Even after this, when I ran docker-compose -p citus up -d, I saw the following error message.

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.26/containers/json: dial unix /var/run/docker.sock: connect: permission denied

This was because I didn't run the Linux postinstall steps in here: https://docs.docker.com/engine/installation/linux/linux-postinstall/

.. code-block:: bash

curl -sSL https://get.docker.com/ | sudo bash
sudo usermod -aG docker $USER && exec su -l $USER
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spinned up a Redhat instance on AWS and got stock at the exec su -l $USER step.

This is because I have sudo on AWS instances but not su.

@begriffs
Copy link
Contributor Author

Waiting to test this on a few EC2 machines until the S3 outage (!) abates.

@begriffs
Copy link
Contributor Author

begriffs commented Mar 1, 2017

@ozgune these instructions worked for me on Red Hat, Ubuntu and Debian on AWS. I was logged in as ec2-user, ubuntu, and admin for each system respectively (not root). The only thing that went wrong is that Debian on AWS did not come pre-bundled with curl and I had to install that. However I'm pretty confident that curl is a common enough tool that our users will either have it or know how to get it.

@jasonmp85
Copy link
Contributor

The only thing that went wrong is that Debian on AWS did not come pre-bundled with curl and I had to install that.

This is also true of the Debian-based Docker images themselves. They're pretty barebones and don't include man or curl or which or many other common things. Weird that the AWS image itself doesn't have any curl, but not something I haven't come across frequently.

I don't think it's e.g. worth investigating wget's availability as an alternative, since if that's the sole place you ran into this we're probably safe, and it's probably a common enough annoyance that users of that platform know where and how to get curl. (i.e. the colloquial name for the idiom is curl | bash, not wget | bash).

@begriffs
Copy link
Contributor Author

begriffs commented Mar 1, 2017

The debian one was actually a community AMI. (ami-0343ae47)

@ozgune
Copy link

ozgune commented Mar 1, 2017

@begriffs -- Sounds good, let's 🚀

I had two side notes. First, we'll need to resolve a minor conflict with the tutorial changes before merging this.

Second, I played around with a few AMIs and things looked good. On SUSE 11, I ran into the following issue. I think that's perfectly acceptable since Docker seems to only support SUSE 12+. The error message here was also pretty descriptive. JFYI:

ec2-user@ip-10-203-133-221:~> curl -sSL https://get.docker.com/ | sudo bash

  Either your platform is not easily detectable, is not supported by this
  installer script (yet - PRs welcome! [hack/install.sh]), or does not yet have
  a package for Docker.  Please visit the following URL for more detailed
  installation instructions:

    https://docs.docker.com/engine/installation/

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

5 participants