Skip to content

Commit

Permalink
Merge pull request #2 from docksal/develop
Browse files Browse the repository at this point in the history
Release 1.0.0
  • Loading branch information
lmakarov authored Feb 8, 2019
2 parents 0b483e7 + 9348ca0 commit d4fd2fd
Show file tree
Hide file tree
Showing 21 changed files with 558 additions and 1 deletion.
30 changes: 30 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
dist: xenial

language: minimal

env:
global:
- REPO=docksal/mariadb

matrix:
- VERSION=5.5 FROM=mariadb:5.5 TAGS=5.5
- VERSION=10.0 FROM=mariadb:10.0 TAGS=10.0
- VERSION=10.1 FROM=mariadb:10.1 TAGS=10.1
- VERSION=10.2 FROM=mariadb:10.2 TAGS=10.2
- VERSION=10.3 FROM=mariadb:10.3 TAGS=10.3,latest

install:
# Install Docksal to have a matching versions of Docker on the build host
- curl -fsSL https://get.docksal.io | bash
- fin version
- fin sysinfo

script:
- make
- make test

after_success:
- ${TRAVIS_BUILD_DIR}/release.sh

after_failure:
- make logs
27 changes: 27 additions & 0 deletions 10.0/default.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
# Use multi-byte UTF (utf8mb4) encoding by default (supports emojis, Asian symbols, mathematical symbols, etc.)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

# Set innodb as default
default_storage_engine = InnoDB

innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128MB

innodb_file_per_table = 1

# See https://github.com/docksal/service-db/pull/1
innodb_file_format = Barracuda
innodb_large_prefix = 1

# Max packets
max_allowed_packet = 128M
20 changes: 20 additions & 0 deletions 10.0/mysql-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_general_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci
default_storage_engine InnoDB
init_connect SET NAMES utf8mb4
innodb_buffer_pool_size 268435456
innodb_file_format Barracuda
innodb_file_per_table ON
innodb_flush_log_at_trx_commit 1
innodb_large_prefix ON
innodb_log_buffer_size 8388608
innodb_log_file_size 134217728
max_allowed_packet 134217728
27 changes: 27 additions & 0 deletions 10.1/default.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
# Use multi-byte UTF (utf8mb4) encoding by default (supports emojis, Asian symbols, mathematical symbols, etc.)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

# Set innodb as default
default_storage_engine = InnoDB

innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128MB

innodb_file_per_table = 1

# See https://github.com/docksal/service-db/pull/1
innodb_file_format = Barracuda
innodb_large_prefix = 1

# Max packets
max_allowed_packet = 128M
20 changes: 20 additions & 0 deletions 10.1/mysql-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_general_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci
default_storage_engine InnoDB
init_connect SET NAMES utf8mb4
innodb_buffer_pool_size 268435456
innodb_file_format Barracuda
innodb_file_per_table ON
innodb_flush_log_at_trx_commit 1
innodb_large_prefix ON
innodb_log_buffer_size 8388608
innodb_log_file_size 134217728
max_allowed_packet 134217728
27 changes: 27 additions & 0 deletions 10.2/default.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
# Use multi-byte UTF (utf8mb4) encoding by default (supports emojis, Asian symbols, mathematical symbols, etc.)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

# Set innodb as default
default_storage_engine = InnoDB

innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128MB

innodb_file_per_table = 1

# See https://github.com/docksal/service-db/pull/1
innodb_file_format = Barracuda
innodb_large_prefix = 1

# Max packets
max_allowed_packet = 128M
20 changes: 20 additions & 0 deletions 10.2/mysql-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_general_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci
default_storage_engine InnoDB
init_connect SET NAMES utf8mb4
innodb_buffer_pool_size 268435456
innodb_file_format Barracuda
innodb_file_per_table ON
innodb_flush_log_at_trx_commit 1
innodb_large_prefix ON
innodb_log_buffer_size 8388608
innodb_log_file_size 134217728
max_allowed_packet 134217728
27 changes: 27 additions & 0 deletions 10.3/default.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
# Use multi-byte UTF (utf8mb4) encoding by default (supports emojis, Asian symbols, mathematical symbols, etc.)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

# Set innodb as default
default_storage_engine = InnoDB

innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128MB

innodb_file_per_table = 1

# See https://github.com/docksal/service-db/pull/1
#innodb_file_format = Barracuda
#innodb_large_prefix = 1

# Max packets
max_allowed_packet = 128M
18 changes: 18 additions & 0 deletions 10.3/mysql-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_general_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci
default_storage_engine InnoDB
init_connect SET NAMES utf8mb4
innodb_buffer_pool_size 268435456
innodb_file_per_table ON
innodb_flush_log_at_trx_commit 1
innodb_log_buffer_size 8388608
innodb_log_file_size 134217728
max_allowed_packet 134217728
27 changes: 27 additions & 0 deletions 5.5/default.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[client]
default-character-set = utf8mb4

[mysql]
default-character-set = utf8mb4

[mysqld]
# Use multi-byte UTF (utf8mb4) encoding by default (supports emojis, Asian symbols, mathematical symbols, etc.)
character_set_server = utf8mb4
collation_server = utf8mb4_unicode_ci
init_connect = 'SET NAMES utf8mb4'

# Set innodb as default
default_storage_engine = InnoDB

innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_log_file_size = 128MB

innodb_file_per_table = 1

# See https://github.com/docksal/service-db/pull/1
innodb_file_format = Barracuda
innodb_large_prefix = 1

# Max packets
max_allowed_packet = 128M
20 changes: 20 additions & 0 deletions 5.5/mysql-variables.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8mb4
character_set_system utf8
collation_connection utf8mb4_general_ci
collation_database utf8mb4_unicode_ci
collation_server utf8mb4_unicode_ci
default_storage_engine InnoDB
init_connect SET NAMES utf8mb4
innodb_buffer_pool_size 268435456
innodb_file_format Barracuda
innodb_file_per_table ON
innodb_flush_log_at_trx_commit 1
innodb_large_prefix ON
innodb_log_buffer_size 8388608
innodb_log_file_size 134217728
max_allowed_packet 134217728
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
ARG FROM
FROM ${FROM}

ARG VERSION

# Docksal settings
COPY ${VERSION}/default.cnf /etc/mysql/conf.d/10-default.cnf

VOLUME /var/lib/mysql

COPY docker-entrypoint.d /docker-entrypoint.d
COPY healthcheck.sh /opt/healthcheck.sh

COPY docker-entrypoint.patch /usr/local/bin/docker-entrypoint.patch

# Apply patch for running scripts placed in /docker-entrypoint.d/* by root
RUN set -xe; \
sed -i '/\$(id -u)/ r /usr/local/bin/docker-entrypoint.patch' /usr/local/bin/docker-entrypoint.sh; \
rm -f /usr/local/bin/docker-entrypoint.patch

EXPOSE 3306
CMD ["mysqld"]

# Health check script
HEALTHCHECK --interval=5s --timeout=1s --retries=12 CMD ["/opt/healthcheck.sh"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Docksal

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
61 changes: 61 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
-include env_make

FROM ?= mariadb:10.3
VERSION ?= 10.3
TAG ?= $(VERSION)

REPO ?= docksal/mariadb
NAME = docksal-mariadb-$(VERSION)

MYSQL_ROOT_PASSWORD = root
MYSQL_USER = user
MYSQL_PASSWORD = user
MYSQL_DATABASE = default

ENV = -e MYSQL_ROOT_PASSWORD=$(MYSQL_ROOT_PASSWORD) -e MYSQL_USER=$(MYSQL_USER) -e MYSQL_PASSWORD=$(MYSQL_PASSWORD) -e MYSQL_DATABASE=$(MYSQL_DATABASE) -e VERSION=$(VERSION)

ifneq ($(STABILITY_TAG),)
ifneq ($(TAG),latest)
override TAG := $(TAG)-$(STABILITY_TAG)
endif
endif

.PHONY: build test push shell run start stop logs clean release

build:
docker build -t $(REPO):$(TAG) --build-arg FROM=$(FROM) --build-arg VERSION=$(VERSION) .

test:
IMAGE=$(REPO):$(TAG) NAME=$(NAME) VERSION=$(VERSION) ./tests/test.bats

push:
docker push $(REPO):$(TAG)

shell: clean
docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG) /bin/bash

run: clean
docker run --rm --name $(NAME) -it $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)

start: clean
docker run -d --name $(NAME) $(PORTS) $(VOLUMES) $(ENV) $(REPO):$(TAG)

exec:
docker exec $(NAME) /bin/bash -c "$(CMD)"

mysql-query:
# Usage: make mysql-query QUERY='SHOW DATABASES;'
docker exec $(NAME) bash -c "mysql --host=localhost --user=root --password=$(MYSQL_ROOT_PASSWORD) -e '$(QUERY)'"

stop:
docker stop $(NAME)

logs:
docker logs $(NAME)

clean:
docker rm -f $(NAME) >/dev/null 2>&1 || true

release: build push

default: build
Loading

0 comments on commit d4fd2fd

Please sign in to comment.