api de gestion de ticket, basé sur php-crud-api. Le but est de décorrélé les outils de gestion des données, afin
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

run.sh 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. PHP=$(php -r 'echo explode("-",phpversion())[0];')
  3. echo "================================================"
  4. echo " Ubuntu 18.04 (PHP $PHP)"
  5. echo "================================================"
  6. echo -n "[1/4] Starting MySQL 5.7 ........ "
  7. # make sure mysql can create socket and lock
  8. mkdir /var/run/mysqld && chmod 777 /var/run/mysqld
  9. # run mysql server
  10. nohup mysqld > /root/mysql.log 2>&1 &
  11. # wait for mysql to become available
  12. while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
  13. sleep 1
  14. done
  15. # create database and user on mysql
  16. mysql -u root >/dev/null << 'EOF'
  17. CREATE DATABASE `php-crud-api` CHARACTER SET utf8 COLLATE utf8_general_ci;
  18. CREATE USER 'php-crud-api'@'localhost' IDENTIFIED BY 'php-crud-api';
  19. GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
  20. FLUSH PRIVILEGES;
  21. EOF
  22. echo "done"
  23. echo -n "[2/4] Starting PostgreSQL 10.4 .. "
  24. # ensure statistics can be written
  25. mkdir /var/run/postgresql/10-main.pg_stat_tmp/ && chmod 777 /var/run/postgresql/10-main.pg_stat_tmp/
  26. # run postgres server
  27. nohup su - -c "/usr/lib/postgresql/10/bin/postgres -D /etc/postgresql/10/main" postgres > /root/postgres.log 2>&1 &
  28. # wait for postgres to become available
  29. until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
  30. sleep 1;
  31. done
  32. # create database and user on postgres
  33. su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
  34. CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
  35. CREATE DATABASE "php-crud-api";
  36. GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
  37. \c "php-crud-api";
  38. CREATE EXTENSION IF NOT EXISTS postgis;
  39. \q
  40. EOF
  41. echo "done"
  42. echo -n "[3/4] Starting SQLServer 2017 ... "
  43. echo "skipped"
  44. echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
  45. # install software
  46. if [ -d /php-crud-api ]; then
  47. echo "skipped"
  48. else
  49. git clone --quiet https://github.com/mevdschee/php-crud-api.git
  50. echo "done"
  51. fi
  52. echo "------------------------------------------------"
  53. # run the tests
  54. cd php-crud-api
  55. php test.php