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

Add support for MySQL 8.0 #100

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,20 @@ jobs:
./.circleci/build_image.sh mysql/Dockerfile gitpod/workspace-mysql
no_output_timeout: 30m

workspace-mysql-8:
docker:
- image: docker:stable
steps:
- checkout
- setup_remote_docker
- attach_workspace:
at: .
- run:
command: |
docker load -i workspace-full.tar
./.circleci/build_image.sh mysql-8.0/Dockerfile gitpod/workspace-mysql-8
no_output_timeout: 30m

workspace-mongodb:
docker:
- image: docker:stable
Expand Down Expand Up @@ -153,6 +167,9 @@ workflows:
- workspace-mysql:
requires:
- workspace-full
- workspace-mysql-8:
requires:
- workspace-full
- workspace-mongodb:
requires:
- workspace-full
Expand Down
48 changes: 48 additions & 0 deletions mysql-8.0/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
FROM gitpod/workspace-full
USER gitpod


##
## -- Set up the environment for a Docker build -- want debconf-utils for later
## -------------------------------------------------------------------------
RUN sudo apt-get update \
&& sudo apt-get install debconf-utils -y -q \
&& sudo apt-get clean \
&& sudo rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*


##
## -- Install the Oracle Repo for MySQL
## ---------------------------------
RUN sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.13-1_all.deb -O /usr/mysql-apt-config_0.8.13-1_all.deb \
&& echo 4 | sudo dpkg -i /usr/mysql-apt-config_0.8.13-1_all.deb \
&& sudo rm /usr/mysql-apt-config_0.8.13-1_all.deb


##
## -- Install MySQL server on top of the basic Docker Container & Freshen up all the other packages just in case
## -----------------------------------------------------------------------------------------------------------
USER root
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install mysql-server mysql-shell -y -q \
&& DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -q \
&& apt-get clean \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/* /tmp/*
USER gitpod


##
## -- Now, we need to prepare for MySQL
## ---------------------------------
RUN sudo mkdir -p /var/run/mysqld /var/lib/mysql-upgrade /usr/share/mysql \
&& sudo chown -R gitpod:gitpod /etc/mysql /var/run/mysqld /var/log/mysql /var/lib/mysql /var/lib/mysql-files /var/lib/mysql-keyring /var/lib/mysql-upgrade /usr/share/mysql
COPY mysql.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
COPY client.cnf /etc/mysql/mysql.conf.d/client.cnf
COPY launch.sh /etc/mysql/mysql-bashrc-launch.sh
RUN sudo chmod +x /etc/mysql/mysql-bashrc-launch.sh


##
## -- Set mysql to start under the gitpod user
## ----------------------------------------
RUN echo "/etc/mysql/mysql-bashrc-launch.sh" >> ~/.bashrc
10 changes: 10 additions & 0 deletions mysql-8.0/client.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[client]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
20 changes: 20 additions & 0 deletions mysql-8.0/launch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# this script is intended to be called from .bashrc
# This is a workaround for not having something like supervisord

if [ ! -e /var/run/mysqld/gitpod-init.lock ]
then
touch /var/run/mysqld/gitpod-init.lock

# initialize database structures on disk, if needed
[ ! -d /workspace/mysql ] && mysqld --initialize-insecure

# launch database, if not running
[ ! -e /var/run/mysqld/mysqld.pid ] && mysqld --daemonize

# secure the installation
[ ! -e /workspace/mysql/.secured ] && mysql_secure_installation && touch /workspace/mysql/.secured

rm /var/run/mysqld/gitpod-init.lock
fi
28 changes: 28 additions & 0 deletions mysql-8.0/mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
user = gitpod
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /workspace/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
lc-messages = en_US
skip-external-locking
bind-address = 127.0.0.1

key_buffer_size = 16M
max_allowed_packet = 16M
thread_stack = 192K
thread_cache_size = 8

myisam-recover-options = BACKUP

general_log_file = /var/log/mysql/mysql.log
general_log = 1
log_error = /var/log/mysql/error.log