Skip to content

Instantly share code, notes, and snippets.

@cemeng
Last active May 28, 2019 07:53
Show Gist options
  • Save cemeng/acbd90eedc2dd0024131ed6f51f797d7 to your computer and use it in GitHub Desktop.
Save cemeng/acbd90eedc2dd0024131ed6f51f797d7 to your computer and use it in GitHub Desktop.
Codeship Install MySQL 5.6
#!/bin/bash
# Install a custom MySQL 5.7 version - https://www.mysql.com
#
# To run this script on Codeship, add the following
# command to your project's setup commands:
# \curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/mysql-5.7.sh | bash -s
#
# Add the following environment variables to your project configuration
# (otherwise the defaults below will be used).
# * MYSQL_VERSION
# * MYSQL_PORT
#
MYSQL_VERSION=${MYSQL_VERSION:="5.6.43"}
MYSQL_PORT=${MYSQL_PORT:="3307"}
MYSQL_DL_URL="https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz"
set -e
MYSQL_DIR=${MYSQL_DIR:=$HOME/mysql-$MYSQL_VERSION}
CACHED_DOWNLOAD="${HOME}/cache/mysql-${MYSQL_VERSION}.tar.gz"
mkdir -p "${MYSQL_DIR}"
wget --continue --output-document "${CACHED_DOWNLOAD}" "${MYSQL_DL_URL}"
tar -xaf "${CACHED_DOWNLOAD}" --strip-components=1 --directory "${MYSQL_DIR}"
mkdir -p "${MYSQL_DIR}/data"
mkdir -p "${MYSQL_DIR}/data/mysql"
mkdir -p "${MYSQL_DIR}/socket"
mkdir -p "${MYSQL_DIR}/log"
echo "#
# The MySQL 5.7 database server configuration file.
#
[client]
port = ${MYSQL_PORT}
socket = ${MYSQL_DIR}/socket/mysqld.sock
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = ${MYSQL_DIR}/socket/mysqld.sock
nice = 0
[mysqld]
user = rof
pid-file = ${MYSQL_DIR}/mysqld.pid
socket = ${MYSQL_DIR}/socket/mysqld.sock
port = ${MYSQL_PORT}
basedir = ${MYSQL_DIR}/data
datadir = ${MYSQL_DIR}/data/mysql
tmpdir = /tmp
lc-messages-dir = ${MYSQL_DIR}/share/english
skip-external-locking
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
# * Fine Tuning
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8
innodb_use_native_aio = 0
# * Query Cache Configuration
query_cache_limit = 1M
query_cache_size = 16M
# * Logging and Replication
log_error = ${MYSQL_DIR}/log/error.log
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[isamchk]
key_buffer = 16M
" > "${MYSQL_DIR}/my.cnf"
@cemeng
Copy link
Author

cemeng commented Mar 4, 2019

curl -sSL https://gist.githubusercontent.com/cemeng/acbd90eedc2dd0024131ed6f51f797d7/raw/48ebdf83dc8cfbdcb29f1448df9a7cb38778dd3d/mysql-install.sh | bash -srvm use 2.1.8 --install
gem install slop -v 3.6.0
ln -sf /usr/lib/x86_64-linux-gnu/ImageMagick-6.9.7/bin-q16/Magick-config ~/bin/Magick-config

gem install rb-inotify -v 0.9.5

gem install bundler -v 1.17.1

gem install net-ssh -v 2.9.2

rm Gemfile.lock

bundle install
export RAILS_ENV=test
bundle exec rake db:schema:load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment