summaryrefslogtreecommitdiffstats
path: root/projectroot
diff options
context:
space:
mode:
Diffstat (limited to 'projectroot')
-rw-r--r--projectroot/etc/group1
-rw-r--r--projectroot/etc/mysql/my.cnf38
-rw-r--r--projectroot/etc/passwd1
-rw-r--r--projectroot/lib/systemd/system/mysqld.service48
-rw-r--r--projectroot/lib/systemd/system/mysqldinit.service36
-rw-r--r--projectroot/sbin/mysqlinit12
6 files changed, 136 insertions, 0 deletions
diff --git a/projectroot/etc/group b/projectroot/etc/group
index 5d491761d..9ff570261 100644
--- a/projectroot/etc/group
+++ b/projectroot/etc/group
@@ -19,6 +19,7 @@ video:x:113:
lock:x:114:
audio:x:115:
input:x:116:
+mysql:x:117:
systemd-journal:x:201:
systemd-network:x:202:
systemd-journal-remote:x:203:
diff --git a/projectroot/etc/mysql/my.cnf b/projectroot/etc/mysql/my.cnf
new file mode 100644
index 000000000..909c0da8c
--- /dev/null
+++ b/projectroot/etc/mysql/my.cnf
@@ -0,0 +1,38 @@
+# For advice on how to change settings please see
+# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
+
+[mysqld]
+innodb_force_recovery = 0
+
+# Remove leading # and set to the amount of RAM for the most important data
+# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
+innodb_buffer_pool_size = 8M
+
+# Remove leading # to turn on a very important data integrity option: logging
+# changes to the binary log between backups.
+# log_bin
+
+# Remove leading # to turn on error logging.
+# log_error=
+# log_error_verbosity=
+
+# we have a read-only filesystem with one persistent writeable area only
+# so point to this single writeable location
+datadir = /var/lib/mysql/data
+
+# These are commonly set, remove the # and set as required.
+# lc-messages-dir = .....
+# plugin-dir = .....
+# basedir = .....
+# port = .....
+# server_id = .....
+# socket = .....
+
+# Remove leading # to set options mainly useful for reporting servers.
+# The server defaults are faster for transactions and fast SELECTs.
+# Adjust sizes as needed, experiment to find the optimal values.
+join_buffer_size = 8M
+sort_buffer_size = 2M
+read_rnd_buffer_size = 2M
+
+sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
diff --git a/projectroot/etc/passwd b/projectroot/etc/passwd
index d8ccb408d..b75ed9f45 100644
--- a/projectroot/etc/passwd
+++ b/projectroot/etc/passwd
@@ -3,6 +3,7 @@ daemon:x:1:1:daemon:/usr/sbin:/bin/sh
ftp:x:11:101:ftp user:/home:/bin/false
www:x:12:102:www user:/home:/bin/false
sshd:x:100:65534:SSH Server:/var/run/sshd:/bin/false
+mysql:x:101:117:mySQL Server:/var/run/mysql:/bin/false
messagebus:x:103:104:messagebus:/dev/null:/bin/false
systemd-network:x:202:202:systemd-network:/dev/null:/bin/false
systemd-resolve:x:203:65534:systemd-resolve:/dev/null:/bin/false
diff --git a/projectroot/lib/systemd/system/mysqld.service b/projectroot/lib/systemd/system/mysqld.service
new file mode 100644
index 000000000..f92d49b90
--- /dev/null
+++ b/projectroot/lib/systemd/system/mysqld.service
@@ -0,0 +1,48 @@
+# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# systemd service file for MySQL forking server
+#
+
+[Unit]
+Description=MySQL Server
+Requires=mysqldinit.service
+After=mysqldinit.service
+
+[Service]
+User=mysql
+Group=mysql
+Type=forking
+
+PIDFile=/tmp/mysqld.pid
+
+# Disable service start and stop timeout logic of systemd for mysqld service.
+TimeoutSec=0
+
+# Start main service
+ExecStart=/usr/bin/mysqld --defaults-file=/etc/mysql/my.cnf --skip-ssl --pid-file=/tmp/mysqld.pid $MYSQLD_OPTS
+
+# Sets open_files_limit
+LimitNOFILE = 5000
+
+Restart=on-failure
+
+RestartPreventExitStatus=1
+
+PrivateTmp=false
+
+[Install]
+WantedBy=multi-user.target
+
diff --git a/projectroot/lib/systemd/system/mysqldinit.service b/projectroot/lib/systemd/system/mysqldinit.service
new file mode 100644
index 000000000..d7aefcc03
--- /dev/null
+++ b/projectroot/lib/systemd/system/mysqldinit.service
@@ -0,0 +1,36 @@
+# Copyright (c) 2016, Pengutronix
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# mySQL run-time preparation
+#
+# Preparation must be run once if the "data" (=working directory) does not
+# exist yet.
+# Since we expect a read-only root filesystem, we need one writeable filesystem
+# part at "/var/mysql".
+#
+# Sinse we change some permissions, the script itself must run as user 'root'
+#
+
+[Unit]
+Description=MySQL Server Initialisation Service
+RequiresMountsFor=/var/lib/mysql
+ConditionPathExists=!/var/lib/mysql/data
+
+[Service]
+User=root
+Group=root
+Type=oneshot
+RemainAfterExit=yes
+
+ExecStart=/sbin/mysqlinit "/var/lib/mysql"
+
+[Install]
+WantedBy=multi-user.target
diff --git a/projectroot/sbin/mysqlinit b/projectroot/sbin/mysqlinit
new file mode 100644
index 000000000..72b6d1f10
--- /dev/null
+++ b/projectroot/sbin/mysqlinit
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+MYSQLD_OPTS=
+
+# since mySQL runs as a regular user, we need to give its working directory
+# to it.
+
+chown mysql.mysql "$1"
+chmod 0755 "$1"
+
+# now let mySQL do its initializing job
+/usr/bin/mysqld --defaults-file=/etc/mysql/my.cnf --initialize --user=mysql --skip-ssl --pid-file=/tmp/mysqld.pid $MYSQLD_OPTS