phpWebSite PHP Cross Reference Content Management Systems

Source: /bootstrap.sh - 243 lines - 7977 bytes - Summary - Text - Print

   1  #!/usr/bin/env bash
   2  
   3  # This is a work-in-progress provisioning script for Vagrant.
   4  # It's not done yet.  Don't use it.
   5  
   6  # Configuration
   7  DBUSER=phpwebsite
   8  DBPASS=phpwebsite
   9  DBNAME=phpwebsite
  10  
  11  CONFIG=/var/phpws/config
  12  FILES=/var/phpws/files
  13  IMAGES=/var/phpws/images
  14  LOGS=/var/phpws/logs
  15  
  16  echo "================"
  17  echo "PHPWEBSITE 1.9.x"
  18  echo "================"
  19  
  20  echo "==================="
  21  echo "Installing Packages"
  22  echo "==================="
  23  yum -y install http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
  24  yum -y install httpd php-cli php-pgsql php-pecl-xdebug php-pdo php php-mbstring php-common php-mysql php-soap php-gd php-xml php-pecl-apc mysql-server mysql postgresql-server postgresql phpmyadmin phpPgAdmin
  25  
  26  echo "================"
  27  echo "Setting up MySQL"
  28  echo "================"
  29  cat << mySQL > /etc/my.cnf
  30  [mysqld]
  31  datadir=/var/lib/mysql
  32  socket=/var/lib/mysql/mysql.sock
  33  user=mysql
  34  symbolic-links=0
  35  bind-address=0.0.0.0
  36  
  37  [mysqld_safe]
  38  log-error=/var/log/mysqld.log
  39  pid-file=/var/run/mysqld/mysqld.pid
  40  mySQL
  41  service mysqld start
  42  mysql -u root <<MySQL
  43  CREATE DATABASE $DBNAME;
  44  GRANT ALL ON $DBNAME.* TO $DBUSER@localhost IDENTIFIED BY '$DBPASS';
  45  GRANT ALL ON *.* TO root@'%';
  46  MySQL
  47  
  48  echo "====================="
  49  echo "Setting up PostgreSQL"
  50  echo "====================="
  51  service postgresql initdb
  52  cat << pgSQL > /var/lib/pgsql/data/pg_hba.conf
  53  local phpwebsite phpwebsite           trust
  54  host  all        postgres   0.0.0.0/0 trust
  55  local all        postgres             trust
  56  pgSQL
  57  echo "listen_addresses = '*'" >> /var/lib/pgsql/data/postgresql.conf
  58  service postgresql start
  59  echo -e 'phpwebsite\nphpwebsite' | su - postgres -c 'createuser -SDREP phpwebsite'
  60  su - postgres -c 'createdb -E utf8 -O phpwebsite phpwebsite'
  61  
  62  echo "==========================="
  63  echo "Configuring php[My|Pg]Admin"
  64  echo "==========================="
  65  cat << 'PGADMIN' > /etc/httpd/conf.d/phpPgAdmin.conf
  66  Alias /phpPgAdmin /usr/share/phpPgAdmin
  67  <Location /phpPgAdmin>
  68      Order deny,allow
  69      Allow from all
  70  </Location>
  71  PGADMIN
  72  cat << 'PGADMINCFG' > /etc/phpPgAdmin/config.inc.php
  73  <?php
  74  $conf['servers'][0]['desc'] = 'PostgreSQL on phpWebSite Vagrant';
  75  $conf['servers'][0]['port'] = 5432;
  76  $conf['servers'][0]['sslmode'] = 'allow';
  77  $conf['servers'][0]['defaultdb'] = 'template1';
  78  $conf['servers'][0]['pg_dump_path'] = '/usr/bin/pg_dump';
  79  $conf['servers'][0]['pg_dumpall_path'] = '/usr/bin/pg_dumpall';
  80  $conf['servers'][0]['slony_support'] = false;
  81  $conf['servers'][0]['slony_sql'] = '/usr/share/pgsql';
  82  $conf['default_lang'] = 'auto';
  83  $conf['autocomplete'] = 'default on';
  84  $conf['extra_login_security'] = false;
  85  $conf['owned_only'] = false;
  86  $conf['show_comments'] = true;
  87  $conf['show_advanced'] = false;
  88  $conf['show_system'] = false;
  89  $conf['show_reports'] = true;
  90  $conf['reports_db'] = 'phppgadmin';
  91  $conf['reports_schema'] = 'public';
  92  $conf['reports_table'] = 'ppa_reports';
  93  $conf['owned_reports_only'] = false;
  94  $conf['min_password_length'] = 1;
  95  $conf['left_width'] = 200;
  96  $conf['theme'] = 'default';
  97  $conf['show_oids'] = false;
  98  $conf['max_rows'] = 30;
  99  $conf['max_chars'] = 50;
 100  $conf['use_xhtml_strict'] = false;
 101  $conf['help_base'] = 'http://www.postgresql.org/docs/%s/interactive/';
 102  $conf['ajax_refresh'] = 3;
 103  $conf['version'] = 19;
 104  ?>
 105  PGADMINCFG
 106  cat << 'MYADMIN' > /etc/httpd/conf.d/phpMyAdmin.conf
 107  Alias /phpMyAdmin /usr/share/phpMyAdmin
 108  <Location /phpMyAdmin>
 109      Order deny,allow
 110      Allow from all
 111  </Location>
 112  MYADMIN
 113  cat << 'MYADMINCFG' > /etc/phpMyAdmin/config.inc.php
 114  <?php
 115  $cfg['blowfish_secret'] = '';
 116  $i = 0;
 117  $i++;
 118  $cfg['Servers'][$i]['host']          = 'localhost';
 119  $cfg['Servers'][$i]['port']          = '';
 120  $cfg['Servers'][$i]['socket']        = '';
 121  $cfg['Servers'][$i]['connect_type']  = 'tcp';
 122  $cfg['Servers'][$i]['extension']     = 'mysqli';
 123  $cfg['Servers'][$i]['compress']      = FALSE;
 124  $cfg['Servers'][$i]['controluser']   = '';
 125  $cfg['Servers'][$i]['controlpass']   = '';
 126  $cfg['Servers'][$i]['auth_type']     = 'http';
 127  $cfg['Servers'][$i]['user']          = '';
 128  $cfg['Servers'][$i]['password']      = '';
 129  $cfg['Servers'][$i]['only_db']       = '';
 130  $cfg['Servers'][$i]['hide_db']       = '';
 131  $cfg['Servers'][$i]['verbose']       = '';
 132  $cfg['Servers'][$i]['pmadb']         = '';
 133  $cfg['Servers'][$i]['bookmarktable'] = '';
 134  $cfg['Servers'][$i]['relation']      = '';
 135  $cfg['Servers'][$i]['table_info']    = '';
 136  $cfg['Servers'][$i]['table_coords']  = '';
 137  $cfg['Servers'][$i]['pdf_pages']     = '';
 138  $cfg['Servers'][$i]['column_info']   = '';
 139  $cfg['Servers'][$i]['history']       = '';
 140  $cfg['Servers'][$i]['verbose_check'] = TRUE;
 141  $cfg['Servers'][$i]['AllowRoot']     = TRUE;
 142  $cfg['Servers'][$i]['AllowDeny']['order'] = '';
 143  $cfg['Servers'][$i]['AllowDeny']['rules'] = array();
 144  $cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
 145  $cfg['Servers'][$i]['designer_coords'] = '';
 146  $cfg['Servers'][$i]['bs_garbage_threshold'] = 50;
 147  $cfg['Servers'][$i]['bs_repository_threshold'] = '32M';
 148  $cfg['Servers'][$i]['bs_temp_blob_timeout'] = 600;
 149  $cfg['Servers'][$i]['bs_temp_log_threshold'] = '32M';
 150  $cfg['UploadDir'] = '/var/lib/phpMyAdmin/upload';
 151  $cfg['SaveDir']   = '/var/lib/phpMyAdmin/save';
 152  $cfg['PmaNoRelation_DisableWarning'] = TRUE;
 153  ?>
 154  MYADMINCFG
 155  
 156  echo "=================="
 157  echo "Configuring Xdebug"
 158  echo "=================="
 159  cat << XDEBUG > /etc/php.d/xdebug.ini
 160  zend_extension=/usr/lib64/php/modules/xdebug.so
 161  xdebug.remote_enable=1
 162  xdebug.remote_handler=dbgp
 163  xdebug.remote_host=10.0.2.2
 164  xdebug.remote_port=9000
 165  xdebug.remote_autostart=0
 166  XDEBUG
 167  
 168  echo "=================="
 169  echo "Configuring Apache"
 170  echo "=================="
 171  rm /etc/httpd/conf.d/welcome.conf
 172  rm -rf /var/www/html
 173  ln -sf /vagrant /var/www/html
 174  service httpd start > /dev/null 2>&1
 175  
 176  echo "===================="
 177  echo "Configuring Firewall"
 178  echo "===================="
 179  iptables -I INPUT 5 -p tcp -m state --state=NEW --dport 80 -j ACCEPT
 180  iptables -I INPUT 6 -p tcp -m state --state=NEW --dport 3306 -j ACCEPT
 181  iptables -I INPUT 7 -p tcp -m state --state=NEW --dport 5432 -j ACCEPT
 182  
 183  echo "============================"
 184  echo "Establishing Writable Mounts"
 185  echo "============================"
 186  mkdir -p "$CONFIG/core" "$FILES" "$IMAGES" "$LOGS"
 187  chown -R apache:apache "$CONFIG" "$FILES" "$IMAGES" "$LOGS"
 188  mount --bind "$CONFIG" /vagrant/config
 189  mount --bind "$FILES" /vagrant/files
 190  mount --bind "$IMAGES" /vagrant/images
 191  mount --bind "$LOGS" /vagrant/logs
 192  
 193  # Helpful Information
 194  cat << USAGE
 195  ===============================================================================
 196  
 197   Thanks for trying phpWebSite!
 198  
 199   The server instance is now set up for you, but you will need to go through
 200   the phpWebSite "setup" process.
 201  
 202   Database Connection Information for this VM:
 203  
 204            Database Type: [either MySQL or PostgreSQL, both work]
 205            Database Name: phpwebsite
 206            Database User: phpwebsite
 207        Database Password: phpwebsite
 208       Port Specification: [leave blank]
 209       Host Specification: [leave blank]
 210  
 211   Available Forwarded Ports (connect to localhost:xxxx):
 212  
 213              SSH: 2222
 214             HTTP: 7970
 215            MySQL: 7971
 216       PostgreSQL: 7972
 217  
 218   Please note that remote paths have been mounted on top of config, files,
 219   images, and logs.  Anything created within Vagrant in these directories will
 220   not appear locally, and anything created locally will not appear in Vagrant.
 221   Additionally, all server-side contents of these directories WILL BE LOST after
 222   you vagrant destroy.
 223  
 224   To connect to MySQL from the command-line client:
 225       mysql -h localhost -P 7971 --protocol=TCP -u root
 226   Or, through phpMyAdmin:
 227       http://localhost:7970/phpMyAdmin
 228       user: root
 229       [leave password blank]
 230   
 231   To connect to PostgreSQL from the command-line client:
 232       psql -h localhost -p 7972 -U postgres
 233   Or, through phpPgAdmin:
 234       http://localhost:7970/phpPgAdmin
 235       user: postgres
 236       [leave password blank]
 237  
 238   And of course, phpWebSite is located at:
 239       http://localhost:7970
 240   so head on over and get started!
 241  
 242  ===============================================================================
 243  USAGE

title

Description

title

Description

title

Description

title

title

Body