Skip to content

Commit

Permalink
Merge pull request #24 from jordiprats/master
Browse files Browse the repository at this point in the history
bugfix removed .sh
  • Loading branch information
jordiprats authored Mar 6, 2018
2 parents 680bab5 + bbeced1 commit d298e07
Show file tree
Hide file tree
Showing 19 changed files with 77 additions and 54 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ matrix:
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="ubuntu14-docker"
dist: trusty
bundler_args:
script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb
- rvm: default
env: BEAKER_set="ubuntu16-docker"
dist: trusty
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 0.4.14

* bugfix: possible dependency cycle

## 0.4.13

* added **sql_mode** and **lower_case_table_names** to **mysqld section**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion files/backup/mysqldump/backupmysqldumpconfig.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IDHOST="ABC1234"
# if set, enables compression
COMPRESS="1"
# mysql instance name - optional
INSTANCE_NAME="<%= @instance %>"
INSTANCE_NAME="demo"
# masterdata - if not set, is set to 1
MASTERDATA="2"
# dump one db at a time if set - optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

function initbck
{

LOGDIR=${LOGDIR-$DESTINATION}

if [ -z "${LOGDIR}" ];
Expand Down Expand Up @@ -107,31 +106,47 @@ function dobackup
if [ "$TODAY_IS_FULL" -eq 1 ];
then
# full
echo "BACKUP FULL:"
innobackupex ${MYSQL_INSTANCE_OPTS} ${DUMPDEST}
else
# incremental

# buscar últim backup OK

# innobackupex --incremental /var/backups/xtrabackup/ --incremental-basedir=/var/backups/xtrabackup/2014-08-25_10-04-45/

# de moment full :D
innobackupex ${MYSQL_INSTANCE_OPTS} ${DUMPDEST}
# incremental si trobo full
if [ -L "${DUMPDEST}/last_full" ];
then
LAST_FULL_DIR=$(readlink "${DUMPDEST}/last_full")
echo "BACKUP INCREMENTAL:"
innobackupex --incremental "${DUMPDEST}" --incremental-basedir="${LAST_FULL_DIR}"
else
echo "BACKUP FULL:"
innobackupex ${MYSQL_INSTANCE_OPTS} ${DUMPDEST}
fi
fi

if [ "$?" -ne 0 ];
then
echo "innobackupex error, check logs - error code: $?"
BCKFAILED=1
else
grep "completed OK!" ${CURRENTBACKUPLOG} > /dev/null 2>&1

if [ "$?" -ne 0 ];
then
echo "innobackupex error - completed OK not found - unexpected log output, please check logs"
BCKFAILED=1
else
# asumim OK
for file in $(find ${DUMPDEST} -maxdepth 2 -iname xtrabackup_info | grep -v last_full | sort -r);
do
grep "incremental = N" $file >/dev/null 2>&1
if [ "$?" -eq 0 ];
then
ln -sf $(dirname $file) ${DUMPDEST}/last_full
break
fi
done
fi
fi

grep "completed OK!" ${CURRENTBACKUPLOG} > /dev/null 2>&1

if [ "$?" -ne 0 ];
then
echo "innobackupex error - completed OK not found - unexpected log output, please check logs"
BCKFAILED=1
fi
}

function cleanup
Expand Down
10 changes: 9 additions & 1 deletion files/backup/xtrabackup/backupxtrabackupconfig.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ IDHOST="ABC1234"
# backup type
BACKUP_NAME_ID="MySQL"
# mysql instance name - optional
INSTANCE_NAME="<%= @instance %>"
INSTANCE_NAME="demo"
#
# to make incremental backups uncomment one of the following:
# FULL_ON_MONTHDAY or FULL_ON_WEEKDAY
#
# make monthly fulls (uncomment FULL_ON_MONTHDAY to make monthly fulls on day 1)
# FULL_ON_MONTHDAY = 1
# make weekly fulls (uncomment FULL_ON_WEEKDAY to make it every sunday)
# FULL_ON_WEEKDAY=7
4 changes: 1 addition & 3 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
$masterdata = '1',
$file_per_db = true,
) {
#
validate_absolute_path($destination)

if defined(Class['netbackupclient'])
{
Expand All @@ -42,7 +40,7 @@
owner => 'root',
group => 'root',
mode => '0700',
content => file("${module_name}/backup/mysqldump/backupmysqldump.sh")
content => file("${module_name}/backup/mysqldump/backupmysqldump")
}

file { "${backupscript}.config":
Expand Down
6 changes: 2 additions & 4 deletions manifests/backup/xtrabackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@
$fullbackup_monthday = undef,
$fullbackup_weekday = undef,
) {
#
validate_absolute_path($destination)

if $fullbackup_monthday!=undef and $fullbackup_weekday!=undef
if ($fullbackup_monthday!=undef and $fullbackup_weekday!=undef)
{
fail('fullbackup_monthday and fullbackup_weekday cannot be defined at the same time')
}
Expand Down Expand Up @@ -50,7 +48,7 @@
owner => 'root',
group => 'root',
mode => '0700',
content => file("${module_name}/backup/xtrabackup/backupxtrabackup.sh")
content => file("${module_name}/backup/xtrabackup/backupxtrabackup")
}

file { "${backupscript}.config":
Expand Down
14 changes: 14 additions & 0 deletions manifests/community.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@
unless => "bash -c 'debconf-get-selections | grep \"mysql-community-server/remove-data-dir\" | grep -P \"boolean[ \\t]*${mysql::remove_data_dir}\"'",
before => Package[$mysql::params::mysql_community_pkgs],
}

exec { 'logdir installation':
command => 'mkdir -p /var/log/mysql',
creates => '/var/log/mysql',
}

file { '/var/log/mysql/error.log':
ensure => 'present',
owner => 'mysql',
group => 'mysql',
mode => '0644',
before => Package[$mysql::params::mysql_community_pkgs],
require => Exec['logdir installation'],
}
}
'RedHat':
{
Expand Down
5 changes: 3 additions & 2 deletions manifests/community/instance.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# puppet2sitepp @mysqlcommunityinstances
define mysql::community::instance (
$password,
$port = '3306',
Expand Down Expand Up @@ -61,12 +62,12 @@
require => Class['::mysql'],
}

~> mysql::community::service { $instance_name:
mysql::community::service { $instance_name:
tag => "eypmysql_${instance_name}",
}

Concat <| tag == "eypmysql_${instance_name}" |>
-> Mysql::Community::Service <| tag == "eypmysql_${instance_name}" |>
~> Mysql::Community::Service <| tag == "eypmysql_${instance_name}" |>

# 5.7
# echo "alter user root@localhost identified by 'password' password expire never;" | mysql -S /var/mysql/test/datadir/mysqld.sock -p$(tail -n1 /var/mysql/test/.mypass) --connect-expired-password
Expand Down
5 changes: 0 additions & 5 deletions manifests/community/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
$service_ensure = 'running',
$service_enable = true,
) {
validate_bool($manage_docker_service)
validate_bool($manage_service)
validate_bool($service_enable)

validate_re($service_ensure, [ '^running$', '^stopped$' ], "Not a valid daemon status: ${service_ensure}")

$is_docker_container_var=getvar('::eyp_docker_iscontainer')
$is_docker_container=str2bool($is_docker_container_var)
Expand Down
7 changes: 0 additions & 7 deletions manifests/service.pp
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
class mysql::service inherits mysql {

#
validate_bool($mysql::manage_docker_service)
validate_bool($mysql::manage_service)
validate_bool($mysql::service_enable)

validate_re($mysql::service_ensure, [ '^running$', '^stopped$' ], "Not a valid daemon status: ${mysql::service_ensure}")

$is_docker_container_var=getvar('::eyp_docker_iscontainer')
$is_docker_container=str2bool($is_docker_container_var)

Expand Down
4 changes: 1 addition & 3 deletions manifests/tools/innochecksum.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@
# Interactive, Inc. <[email protected]>
#
# Published with a permission.
#
#
class mysql::tools::innochecksum (
$binpath = '/usr/local/bin/innochecksum'
) inherits mysql::params {

validate_absolute_path($binpath)

file { $binpath:
ensure => 'present',
owner => 'root',
Expand Down
1 change: 1 addition & 0 deletions manifests/xtradbcluster/instance.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# puppet2sitepp @mysqlxtradbclusterinstances
define mysql::xtradbcluster::instance (
$password,
$serverid,
Expand Down
5 changes: 0 additions & 5 deletions manifests/xtradbcluster/service.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
$service_ensure = 'running',
$service_enable = true,
) {
validate_bool($manage_docker_service)
validate_bool($manage_service)
validate_bool($service_enable)

validate_re($service_ensure, [ '^running$', '^stopped$' ], "Not a valid daemon status: ${service_ensure}")

$is_docker_container_var=getvar('::eyp_docker_iscontainer')
$is_docker_container=str2bool($is_docker_container_var)
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eyp-mysql",
"version": "0.4.13",
"version": "0.4.14",
"author": "eyp",
"summary": "multi instance mysql community and Percona XtraDB cluster (galera)",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/nodesets/ubuntu14-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ HOSTS:
image: ubuntu:14.04
docker_preserve_image: true
docker_image_commands:
- 'apt-get install gcc make tar wget openjdk-7-jdk openjdk-7-jre -y'
- 'apt-get install cron gcc make tar wget openjdk-7-jdk openjdk-7-jre -y'
CONFIG:
type: foss
log_level: debug
2 changes: 1 addition & 1 deletion spec/acceptance/nodesets/ubuntu16-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ HOSTS:
docker_cmd: '["/sbin/init"]'
docker_preserve_image: true
docker_image_commands:
- 'apt-get install net-tools gcc make tar wget net-tools -y'
- 'apt-get install cron net-tools gcc make tar wget net-tools -y'
CONFIG:
type: foss
log_level: debug
8 changes: 8 additions & 0 deletions templates/backup/xtrabackup/backupxtrabackupconfig.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ FULL_ON_MONTHDAY="<%= @fullbackup_monthday %>"
FULL_ON_WEEKDAY="<%= @fullbackup_weekday %>"
<% end -%>
INSTANCE_NAME="<%= @instance %>"
<% if defined?(@fullbackup_monthday) -%>
# make monthly fulls
FULL_ON_MONTHDAY=<%= @fullbackup_monthday %>
<% end -%>
<% if defined?(@fullbackup_weekday) -%>
# make weekly fulls
# FULL_ON_WEEKDAY=<%= @fullbackup_weekday %>
<% end -%>

0 comments on commit d298e07

Please sign in to comment.