This commit is contained in:
William Mantly 2019-07-04 20:58:20 -04:00
parent 23a4e98668
commit 47caaa7a0a
Signed by: wmantly
GPG Key ID: E1EEC7650BA97160
10 changed files with 589 additions and 577 deletions

32
Vagrantfile vendored
View File

@ -61,25 +61,25 @@ Vagrant.configure("2") do |config|
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use. # documentation for more information about their specific syntax and use.
config.vm.provision "shell", inline: <<~SHELL config.vm.provision "shell", inline: <<~SHELL
if ! apt list ruby2.5 | grep installed; then # if ! apt list ruby2.5 | grep installed; then
apt-add-repository ppa:brightbox/ruby-ng -y # apt-add-repository ppa:brightbox/ruby-ng -y
apt-get update # apt-get update
sudo apt-get install -y build-essential resolvconf ruby2.5 ruby2.5-dev gem # sudo apt-get install -y build-essential resolvconf ruby2.5 ruby2.5-dev gem
fi # fi
if ! which berks >/dev/null; then # if ! which berks >/dev/null; then
gem install berkshelf --no-ri --no-rdoc # gem install berkshelf --no-ri --no-rdoc
# ln -s /opt/chef/embedded/bin/berks /usr/local/bin/berks # # ln -s /opt/chef/embedded/bin/berks /usr/local/bin/berks
fi # fi
cd /vagrant # cd /vagrant
git submodule update --init --recursive # git submodule update --init --recursive
cd /vagrant/ops/cookbooks # cd /vagrant/ops/cookbooks
rm -rf vendor # rm -rf vendor
rm -rf $HOME/.berksfile # rm -rf $HOME/.berksfile
berks update # berks update
berks vendor vendor # berks vendor vendor
SHELL SHELL
config.vm.provision 'chef_solo' do |chef| config.vm.provision 'chef_solo' do |chef|

View File

@ -3,6 +3,6 @@ cookbook_file '/tmp/datacom_abc.sql' do
end end
execute 'Seed MySQL DB' do execute 'Seed MySQL DB' do
command "mysql -h localhost -u\"#{node['db']['user']}\" -p\"#{node['db']['password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql" command "mysql -h 127.0.0.1 -u\"#{node['db']['user']}\" -p\"#{node['db']['password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql"
not_if "$(mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0" not_if "$(mysql -h 127.0.0.1 -u\"#{node['db']['user']}\" -p\"#{node['db']['password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0"
end end

View File

@ -3,6 +3,6 @@ cookbook_file '/tmp/datacom_abc.sql' do
end end
execute 'Seed MySQL DB' do execute 'Seed MySQL DB' do
command "mysql -h localhost -u\"#{node['db']['user']}\" -p\"#{node['db']['password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql" command "mysql -h localhost -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql"
not_if "$(mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0" not_if "$(mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0"
end end

View File

@ -3,6 +3,6 @@ cookbook_file '/tmp/datacom_abc.sql' do
end end
execute 'Seed MySQL DB' do execute 'Seed MySQL DB' do
command "mysql -h localhost -u\"#{node['db']['user']}\" -p\"#{node['db']['password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql" command "mysql -h localhost -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" < /tmp/datacom_abc.sql"
not_if "$(mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0" not_if "$(mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" \"#{node['db']['name']}\" -sse \"select count(*) from test_dec;\") -gt 0"
end end

View File

@ -1,11 +1,20 @@
[ [
'apache2', 'apache2',
'apache2-dev', 'apache2-dev',
'libapache2-mod-wsgi-py3',
].each do |pkg| ].each do |pkg|
apt_package pkg apt_package pkg
end end
if node['web']['wsgi']
[
'libapache2-mod-wsgi-py3',
].each do |pkg|
apt_package pkg
end
end
file '/etc/apache2/sites-enabled/000-default.conf' do file '/etc/apache2/sites-enabled/000-default.conf' do
action :delete action :delete
end end

View File

@ -11,11 +11,11 @@ end
bash 'Make mysql Database and User' do bash 'Make mysql Database and User' do
code <<~EOH code <<~EOH
mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "CREATE DATABASE '#{node['db']['name']}' /*\!40100 DEFAULT CHARACTER SET utf8 */;" mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "CREATE DATABASE #{node['db']['name']};"
mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "CREATE USER '#{node['db']['user']}'@localhost IDENTIFIED BY '#{node['db']['password']}';" mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "CREATE USER #{node['db']['user']}@localhost IDENTIFIED BY '#{node['db']['password']}';"
mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "GRANT ALL PRIVILEGES ON '#{node['db']['name']}'.* TO '#{node['db']['user']}'@'%';" mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "GRANT ALL PRIVILEGES ON #{node['db']['name']}.* TO #{node['db']['user']}@localhost;"
mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "FLUSH PRIVILEGES;" mysql -h 127.0.0.1 -uroot -p"#{node['db']['root_password']}" -e "FLUSH PRIVILEGES;"
EOH EOH
not_if "mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" -e 'use #{node['db']['name']}'" # not_if "mysql -h 127.0.0.1 -uroot -p\"#{node['db']['root_password']}\" -e 'use #{node['db']['name']}'"
end end

View File

@ -44,9 +44,10 @@
<% if node['web']['root'] %> <% if node['web']['root'] %>
DocumentRoot <%= node['web']['root'] %> DocumentRoot <%= node['web']['root'] %>
<Directory <%= node['web']['root'] %>/> <Directory <%= node['web']['root'] %>/>
Options Indexes FollowSymLinks Options Indexes FollowSymLinks MultiViews
AllowOverride None AllowOverride None
Require all granted Order allow,deny
allow from all
</Directory> </Directory>
<% end -%> <% end -%>

View File

@ -23,7 +23,7 @@ defined('BASEPATH') OR exit('No direct script access allowed');
| a PHP script and you can easily do that on your own. | a PHP script and you can easily do that on your own.
| |
*/ */
$config['base_url'] = 'http://demo.phpwebsite.in/abc/'; $config['base_url'] = 'http://localhost';
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------

6
php/application/config/database.php Normal file → Executable file
View File

@ -76,9 +76,9 @@ $query_builder = TRUE;
$db['default'] = array( $db['default'] = array(
'dsn' => '', 'dsn' => '',
'hostname' => 'localhost', 'hostname' => 'localhost',
'username' => 'phpwe4km_abc', 'username' => 'datacom_abc',
'password' => 'VOtMA5$_88-Y', 'password' => '3dba6d57248e16ccd0b187383e',
'database' => 'phpwe4km_abc', 'database' => 'datacom_abc',
'dbdriver' => 'mysqli', 'dbdriver' => 'mysqli',
'dbprefix' => '', 'dbprefix' => '',
'pconnect' => FALSE, 'pconnect' => FALSE,

File diff suppressed because it is too large Load Diff