Skip to content

Instantly share code, notes, and snippets.

@ivanalejandro0
Last active August 29, 2015 14:10
Show Gist options
  • Save ivanalejandro0/1e803b94c14952daafcb to your computer and use it in GitHub Desktop.
Save ivanalejandro0/1e803b94c14952daafcb to your computer and use it in GitHub Desktop.
Firts attempt to run the LEAP platform on a single docker container.
#!/bin/bash
# Following instructions from: https://leap.se/en/docs/platform/tutorials/single-node
# Docker command line:
# docker run -it --name leap -h node1 -v ~/tmp/:/shared debian:wheezy /bin/bash
set -e # Exit immediately if a command exits with a non-zero status.
set -x # show commands
# Prepare your environment
# ========================
# Install pre-requisites
apt-get update
apt-get install -y git ruby ruby-dev rsync openssh-client openssl rake make bzip2
apt-get install -y ssh netcat cron # not in docs
service ssh start
# Install the LEAP command-line utility
# -------------------------------------
# note: from gem or git-master failed, see https://leap.se/code/issues/6395
git clone -b develop https://leap.se/git/leap_cli
cd leap_cli
rake build
USER="root" rake install
# Check out the platform
# ----------------------
mkdir ~/leap
cd ~/leap
git clone -b develop --recursive https://leap.se/git/leap_platform.git
# Provider Setup
# ==============
mkdir -p ~/leap/example
# Bootstrap the provider
# ----------------------
cd ~/leap/example
leap new --contacts [email protected] --domain leap.example.org --name Example --platform=~/leap/leap_platform .
# NOTE/HACK: ssh-keygen needed here!
ssh-keygen -b 1024 -N '' -f ~/.ssh/id_dsa -t dsa -q
leap add-user --self
# Create provider certificates
# ----------------------------
leap cert ca
leap cert csr
# NOTE: this fives an error:
# = error Errno::ENOENT: No such file or directory - file files/ca/ca.crt
leap inspect files/ca/ca.crt
# Edit provider.json configuration
# --------------------------------
# SKIPPED THIS
# ran docker with '-h node1' to avoid problems in here.
# Setup the provider’s node and services
# --------------------------------------
IP_ADDR=`ip addr show eth0 | awk '/inet / { print $2 }' | sed 's#/.*##'`
leap node add node1 ip_address:$IP_ADDR services:couchdb,mx,soledad,webapp tags:production
# Setup DNS
# ---------
# NOTE: error in docs, no leap prefix (leap.example.org is used on `leap new` example)
echo "$IP_ADDR node1.leap.example.org node1.leap.example.org leap.example.org api.leap.example.org nicknym.leap.example.org" >> /etc/hosts
# Initialize the nodes
# NOTE: this asks for password on node if no public key auth is possible
cd ~ && cat .ssh/id_dsa.pub >> .ssh/authorized_keys # HACK to avoid password ask
cd ~/leap/example/
echo '@log = "~/leap/deploy.log"' >> Leapfile
echo y | leap node init production
# Deploy the LEAP platform to the nodes
# -------------------------------------
# NOTE: I get an error due /etc/hosts, I don't know why right now.
# Commenting out 'site_config::hosts' on /root/leap/leap_platform/puppet/modules/site_config/manifests/setup.pp
# class { 'site_config::hosts':
# stage => setup,
# }
# it seems to work (without that particular step, of course)
leap deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment