Skip to content
/ bits Public

A collection of bash scripts for configuring your server

Notifications You must be signed in to change notification settings

capbash/bits

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bits

An opinionated view on installing software.

A collection of stand-alone bash scripts for provisioning a bare metal server.

How to Install bits CLI

To install from scratch, run

bash <(curl -s https://raw.githubusercontent.com/capbash/bits/master/bits-installer)

This will install capbash into /usr/local/bin/bits. To install it somewhere else, for example:

bash <(curl -s https://raw.githubusercontent.com/capbash/bits/master/bits-installer) --path /tmp

If you don't trust this project, please don't pipe into bash, and instead download the file, inspect it and run it directly.

If you already have bits and want to upgrade to the altest, please run

bits update-self

How to Install a Bit

Once your bits installed (from above), you can install other bits by running

bits install <BIT_NAME>

For example,

bits install elixir

All available configurations are managed through environment variables. If you wanted a different version of elixir, then you would run

ELIXIR_VERSION=1.11.4 bits install elixir

How to Install A Bit Directly

If you don't like the idea of installing the "bits" command line tool, then you can install the bits directly using bash and curl.

For example

bash <(curl -s https://raw.githubusercontent.com/capbash/bits/master/elixir.bits)

To override defaults, set it as an environment variable

ELIXIR_VERSION=1.11.4 bash <(curl -s https://raw.githubusercontent.com/capbash/bits/master/elixir.bits)

If you don't trust this project, please don't pipe into bash, and instead download the file, inspect it and run it directly.

Available Bits

apache.bits

Install Apache 2. Available configurations with defaults include

APACHE_VERSION=2.4.25
APACHE_UPDATERC=true

To install, run

bits install apache

If APACHE_UPDATERC is set to true, it will register itself with update-rc to automatically start when booting up the system.

Once installed, you can see the availbale options by running

sudo service apache

brew.bits

Brew is the Missing Package Manager for macOS (or Linux).

To install, run

bits install brew

certbot.bits

Certbox is a replacement to Let's Encyrpt script.

To install, run

bits install certbot

chromedriver.bits

Installs Chrome Driver on your system. Available configurations with defaults include

CHROMEDRIVER_VERSION=2.21

To install, run

bits install chromedriver

composer.bits

Composer is a dependency manager for PHP.

To install, run

bits install composer

devboxdio.bits

Creates a Digital Ocean droplet that is ready for development. It will create the specified IMAGE of a specific SIZE.

This bit requires Dio installed locally, with a valid TOKEN to access the Digital Ocean API.

PREFIX=devbox
NAME=${PREFIX}${TS}
IMAGE=ubuntu-14-04-x64
SIZE=512mb
SLEEP=60
LOGFILE=/tmp/devbox_$NAME.log

To install, run

bits install devboxdio

doctl.bits

Installs Doctl is a command line interface to Digital Ocean API

DOCTL_VERSION=1.6.1
PLATFORM=linux
DOCTL_BIN=/opt/doctl/1.6.1/bin

To install, run

bits install doctl

elixir.bits

Installs Elixir, which also needs Erlang, on your system.

These scripts are definitely biased towards Ubuntu, so you will probably want to stay within this family of distibutions:

  • Ubuntu 14.04 trusty
  • Ubuntu 16.04 xenial
  • Ubuntu 18.04 bionic

Available configurations with defaults include

# From erlang.bits
ERLANG_VERSION=23.2-1
ELIXIR_VERSION=1.11.4

To install, run

bits install elixir

erlang.bits

Installs Erlang on your system. Available configurations with defaults include

ERLANG_VERSION=23.2-1

To install, run

bits install erlang

git.bits

Install git.

GIT_VERSION=latest

To install, run

bits install git

gitclone.bits

Clone a git project. Available configurations with defaults include

NAME=samplephp
URL=https://github.com/capbash/samplephp

INSTALL_DIR=/var/local/apps
USER_EMAIL=server@localhost
USER_NAME=server
GIT_REMOTE=origin
BRANCH=master
TAG=master

To install, run

NAME=samplephp \
  URL=https://github.com/capbash/samplephp \
  TAG=v0.2 \
  bits install gitclone

gitconfig.bits

Configure a remote git to the desired settings. Available configurations with defaults include

EMAIL=you@example.com
USERNAME="Ben Dover"
EDITOR=vi
PUSH=simple

To install, run

EMAIL=yourname@example.com \
  USERNAME=yourname \
  bits install gitconfig

gitprompt.bits

Configure your bash prompt to show important git branch information. Once configured your prompt will look similar to:

11:35 /src/bits (master)$

To install, run

bits install gitprompt

inotify.bits

Configure a inotify-tools on your server.

To install, run

bits install inotify

ioncube.bits

Configure a ION Cube on your server.

Available configurations with defaults include

PHP_LIB_DATE=20131226
PHP_LIB_DIR=/usr/lib/php/${PHP_LIB_DATE}
PHP_VERSION=5.6
CONFD_DIR=/etc/php/${PHP_VERSION}/apache2/conf.d

To install, run

bits install ioncube

jumpcloud.bits

Configure a JumpCloud daemon on your server.

To install, run

JUMPCLOUD_TOKEN=fill_me_in \
  bits install jumpcloud

knownhosts.bits

Configure your server to trust all hosts so that you can, for example, access services like GitHub and Bitbucket to download code.

To install, run

bits install knownhosts

letsencrypt.bits

This is obsolete, use certbox instead.

Installs Let's Encyrpt. To install, run

bits install letsencrypt

libsass.bits

Installs libsass and sassc (needed by node-sass and useful with Phoenix). A thank you to edouard-lopez for the fix.

To install, run

bits install libsass

marketplace-partners.bits

Based on Digital Oceans Marketplace Docs, this will install two helper scripts.

To install, run

bits install marketplace-partners

After being installed, two helper scripts are available

First, the clean-up your image

/usr/local/bin/marketplace-cleanup

Second, to verify your image

/usr/local/bin/marketplace-validation

nginx.bits

Install Nginx.

To install, run

bits install nginx

Once installed, you can see the availbale options by running

systemctl status nginx

A huge thank you to Digital Ocean for the instalation documentation.

nodejs.bits

Install NodeJS. Available configurations with defaults include

NODE_VERSION=11.9.0
bits install nodejs

openssh-server.bits

Install OpenSSH server.

bits install openssh-server

mysql.bits

Installs MySQL. Available configurations with defaults include

MYSQL_VERSION=5.7.24
MYSQL_USER=mysql
MYSQL_DATADIR=/usr/local/mysql/data
MYSQL_ROOT_PASSWORD=nicetry

Available MYSQL versions include (and will change frequently)

  • 5.5.62
  • 5.6.42
  • 5.7.24

To install, run

bits install mysql

ncurses.bits

Installs Ncurses required for Erlang. To install, run

bits install ncurses

php.bits

Installs PHP. Available configurations with defaults include

PHP_VERSION=5.6

Available PHP versions include

  • 5.6

To install, run

bits install php

pip.bits

Installs Pip. Available configurations with defaults include

# From python.bits
PYTHON_VERSION=2.7.11

To install, run

bits install pip

python.bits

Installs Python. Available configurations with defaults include

PYTHON_VERSION=2.7.11

To install, run

bits install python

phoenix.bits

Installs Erlang (using erlang.bits) and Elixir (using elixir.bits), Sass (using sass.bits), Libsass (through sass.bits), Ruby (through sass.bits), Postgres (using postgres.bits), Node JS (using nodejs.bits) and then installs Phoenix. Available configurations with defaults include

# From erlang.bits
ERLANG_VERSION=23.2-1

# From elixir.bits
ELIXIR_VERSION=1.11.4

# From gitconfig.bits
EMAIL=you@example.com
USERNAME="Ben Dover"
EDITOR=vi
PUSH=simple

# From postgres.bits
POSTGRES_VERSION=11
PGADMIN_VERSION=3

# From ruby.bits (through sass.bits)
RUBY_VERSION=2.2.3

PHOENIX_VERSION=1.5.8
NODE_VERSION=11.9.0

To install, run

bits install phoenix

phoenixapp.bits

You must ensure that your remote machine has the proper access to the git server. This could be done, by scp'ing a trusted public/private key that is authorized by your git server.

For example,

scp $HOME/.ssh/id_rsa.pub <remote_server>:/root/.ssh/
scp $HOME/.ssh/id_rsa <remote_server>:/root/.ssh/

Installs Erlang (using erlang.bits) and Elixir (using elixir.bits), and then Postgres (using postgres.bits), and Node JS (using nodejs.bits) and Phoenix (using phoenix.bits). Then it will download a phoenix umbrella app where the phoenix web app should be located at ./apps/webapp. If you want to configure your app differently, then just spin up a phoenix.bit and configure as you wish.

Available configurations with defaults include

# From erlang.bits
ERLANG_VERSION=23.2-1

# From elixir.bits
ELIXIR_VERSION=1.11.4

# From gitconfig.bits
EMAIL=you@example.com
USERNAME="Ben Dover"
EDITOR=vi
PUSH=simple

# From postgres.bits
POSTGRES_VERSION=11
PGADMIN_VERSION=3

# From phoenix.bits
PHOENIX_VERSION=1.5.8
NODE_VERSION=11.9.0

SRC_DIR=/src
GIT_URL="git@bitbucket.org:capbash/samplephoenix.git"
GIT_BRANCH="master"
PROJECT_NAME="samplephoenix"

To install, run

GIT_URL=git@github.com:capbash/samplephoenix.git \
  PROJECT_NAME=samplephoenix \
  bits install phoenixapp

phoenixdio.bits

Creates a Digital Ocean private image with everything to quickly spin up a phoenix ready development environment. It does not expose all available configurations (e.g. which version of ERLANG, or NODE_JS), so if you need something more customizable, then please consider wrapping this functionality directly.

This bit requires Dio installed locally, with a valid TOKEN to access the Digital Ocean API.

ERLANG_VERSION=23.2-1
ELIXIR_VERSION=1.11.4
PHOENIX_VERSION=1.5.8
POSTGRES_VERSION=11
NAME=elixir${ELIXIR_VERSION//[.|-]/}phoenix${PHOENIX_VERSION//[.|-]/}postgres${POSTGRES_VERSION//[.|-]/}
LOGFILE=/tmp/$NAME.log
SIZE=512mb
SLEEP=60

To install, run

bits install phoenixdio

postgres.bits

Installs Postgres.

The distributions and versions are available at:

These scripts are definitely biased towards Ubuntu, so you will probably want to stay within this family of distibutions:

  • Ubuntu 14.04 trusty
  • Ubuntu 16.04 xenial
  • Ubuntu 18.04 bionic

Available configurations with defaults include

POSTGRES_VERSION=11
PGADMIN_VERSION=3

To install, run

bits install postgres

redis.bits

Installs Redis. Available configurations with defaults include

REDIS_VERSION=stable

To install, run

bits install redis

ruby.bits

Installs Ruby.

These scripts are definitely biased towards Ubuntu, so you will probably want to stay within this family of distibutions:

  • Ubuntu 14.04 trusty
  • Ubuntu 16.04 xenial
  • Ubuntu 18.04 bionic # (not supported yet)

Available configurations with defaults include

RUBY_VERSION=2.5.3
RUBY_MODE=bin  # or source

To install, run

bits install ruby

sass.bits

Installs SASS. Available configurations with defaults include

RUBY_VERSION=2.2.3

To install, run

bits install sass

snapshotdio.bits

Creates a Digital Ocean snapshot for re-use.

This bit requires Dio installed locally, with a valid TOKEN to access the Digital Ocean API.

ID=${ID}
NAME=${NAME}
DELETE=false

To create an image called myapp against a droplet 1234 (could also be it's name, if it is unique, then run

ID=1234 NAME=myapp bits install sass

If you have DELETE=true, then it will delete the snapshot when it's done.

swap.bits

Install swap space on you server Available configurations with defaults include

SWAP_SIZE=4G

To install, run

bits install swap

ufw.bits

The uncomplicated firewall should be installed, but if it's not you can install it using

bits install ufw

About

A collection of bash scripts for configuring your server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages