|
@@ -0,0 +1,37 @@
|
|
1
|
+# initialize mysql
|
|
2
|
+mysql_install_db > /dev/null
|
|
3
|
+chown -R mysql:mysql /var/lib/mysql
|
|
4
|
+# run mysql server
|
|
5
|
+nohup /usr/libexec/mysqld -u mysql > /root/mysql.log 2>&1 &
|
|
6
|
+# wait for mysql to become available
|
|
7
|
+while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
|
|
8
|
+ sleep 1
|
|
9
|
+done
|
|
10
|
+# create database and user on mysql
|
|
11
|
+mysql -u root >/dev/null << 'EOF'
|
|
12
|
+CREATE DATABASE `php-crud-api` CHARACTER SET utf8 COLLATE utf8_general_ci;
|
|
13
|
+CREATE USER 'php-crud-api'@'localhost' IDENTIFIED BY 'php-crud-api';
|
|
14
|
+GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
|
|
15
|
+FLUSH PRIVILEGES;
|
|
16
|
+EOF
|
|
17
|
+
|
|
18
|
+# initialize postgresql
|
|
19
|
+su - -c "/usr/bin/initdb --auth-local peer --auth-host password -D /var/lib/pgsql/data" postgres > /dev/null
|
|
20
|
+# run postgres server
|
|
21
|
+nohup su - -c "/usr/bin/postgres -D /var/lib/pgsql/data" postgres > /root/postgres.log 2>&1 &
|
|
22
|
+# wait for postgres to become available
|
|
23
|
+until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
|
|
24
|
+ sleep 1;
|
|
25
|
+done
|
|
26
|
+# create database and user on postgres
|
|
27
|
+su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
|
|
28
|
+CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
|
|
29
|
+CREATE DATABASE "php-crud-api";
|
|
30
|
+GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
|
|
31
|
+\q
|
|
32
|
+EOF
|
|
33
|
+
|
|
34
|
+# run the tests
|
|
35
|
+cd /root/php-crud-api
|
|
36
|
+git pull
|
|
37
|
+php phpunit.phar
|