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
Ви не можете вибрати більше 25 тем Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #!/bin/bash
  2. echo "================================================"
  3. echo " Ubuntu 16.04 (PHP 7.0)"
  4. echo "================================================"
  5. echo -n "[1/4] Starting MariaDB 10.0 ..... "
  6. # make sure mysql can create socket and lock
  7. mkdir /var/run/mysqld && chmod 777 /var/run/mysqld
  8. # run mysql server
  9. nohup mysqld > /root/mysql.log 2>&1 &
  10. # wait for mysql to become available
  11. while ! mysqladmin ping -hlocalhost >/dev/null 2>&1; do
  12. sleep 1
  13. done
  14. # create database and user on mysql
  15. mysql -u root >/dev/null << 'EOF'
  16. CREATE DATABASE `php-crud-api` CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
  17. CREATE USER 'php-crud-api'@'localhost' IDENTIFIED BY 'php-crud-api';
  18. GRANT ALL PRIVILEGES ON `php-crud-api`.* TO 'php-crud-api'@'localhost' WITH GRANT OPTION;
  19. FLUSH PRIVILEGES;
  20. EOF
  21. echo "done"
  22. echo -n "[2/4] Starting PostgreSQL 9.5 ... "
  23. # run postgres server
  24. nohup su - -c "/usr/lib/postgresql/9.5/bin/postgres -D /etc/postgresql/9.5/main" postgres > /root/postgres.log 2>&1 &
  25. # wait for postgres to become available
  26. until su - -c "psql -U postgres -c '\q'" postgres >/dev/null 2>&1; do
  27. sleep 1;
  28. done
  29. # create database and user on postgres
  30. su - -c "psql -U postgres >/dev/null" postgres << 'EOF'
  31. CREATE USER "php-crud-api" WITH PASSWORD 'php-crud-api';
  32. CREATE DATABASE "php-crud-api";
  33. GRANT ALL PRIVILEGES ON DATABASE "php-crud-api" to "php-crud-api";
  34. \c "php-crud-api";
  35. CREATE EXTENSION IF NOT EXISTS postgis;
  36. \q
  37. EOF
  38. echo "done"
  39. echo -n "[3/4] Starting SQLServer 2017 ... "
  40. # run sqlserver server
  41. nohup /opt/mssql/bin/sqlservr --accept-eula > /root/mssql.log 2>&1 &
  42. # create database and user on postgres
  43. /opt/mssql-tools/bin/sqlcmd -l 30 -S localhost -U SA -P sapwd123! >/dev/null << 'EOF'
  44. CREATE DATABASE [php-crud-api]
  45. GO
  46. CREATE LOGIN [php-crud-api] WITH PASSWORD=N'php-crud-api', DEFAULT_DATABASE=[php-crud-api], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
  47. GO
  48. USE [php-crud-api]
  49. GO
  50. CREATE USER [php-crud-api] FOR LOGIN [php-crud-api] WITH DEFAULT_SCHEMA=[dbo]
  51. exec sp_addrolemember 'db_owner', 'php-crud-api';
  52. GO
  53. exit
  54. EOF
  55. echo "done"
  56. echo -n "[4/4] Cloning PHP-CRUD-API v2 ... "
  57. # install software
  58. if [ -d /php-crud-api ]; then
  59. echo "skipped"
  60. else
  61. git clone --quiet https://github.com/mevdschee/php-crud-api.git
  62. echo "done"
  63. fi
  64. echo "------------------------------------------------"
  65. # run the tests
  66. cd php-crud-api
  67. php test.php