mirror of
https://gitlab.com/depesz/explain.depesz.com.git
synced 2025-02-19 19:44:40 +02:00
Parameter based project dir path.
This commit is contained in:
parent
0c9ebb5936
commit
cccef5552a
@ -24,7 +24,8 @@ WARNING: first call `vagrant up` fetches ~400MB of vbox image from the Internet.
|
||||
## Puppet setup
|
||||
|
||||
1. Install puppet on your machine, e.g. Debian installation described [here](https://docs.puppetlabs.com/guides/install_puppet/install_debian_ubuntu.html).
|
||||
2. Call `sudo puppet apply --logdest console manifests/default.pp` on your working copy directory.
|
||||
2. Open explain.pp and fix line 5 with correct project dir value
|
||||
3. Call `sudo puppet apply --logdest console manifests/default.pp` on your working copy directory.
|
||||
|
||||
## Manual setup
|
||||
|
||||
|
3
Vagrantfile
vendored
3
Vagrantfile
vendored
@ -14,5 +14,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
|
||||
config.vm.provision "puppet" do |puppet|
|
||||
puppet.options = "--verbose --debug"
|
||||
puppet.facter = {
|
||||
"use_vagrant" => true
|
||||
}
|
||||
end
|
||||
end
|
||||
|
@ -1,3 +1,11 @@
|
||||
# Unfortunately there is no way to automatically detect current project directory
|
||||
if $use_vagrant {
|
||||
$PROJECT_DIR = '/vagrant'
|
||||
} else {
|
||||
fail('Replace this line with correct $PROJECT_DIR value assignment.')
|
||||
}
|
||||
|
||||
|
||||
# We need to order provision commands [ https://docs.puppetlabs.com/learning/ordering.html ]
|
||||
Exec['update_pkgs_index']->
|
||||
Package['curl'] ->
|
||||
@ -43,18 +51,17 @@ exec { 'install_cpanm_mojolicious': command => 'cpanm --notest Mojolicious' }
|
||||
exec { 'createuser': command => 'sudo -u postgres psql -c "create role explaind with login password \'explaind\'"' }
|
||||
exec { 'createdb': command => 'sudo -u postgres createdb -E utf8 -O explaind explaind' }
|
||||
|
||||
# FIXME: path to sql-files should be relative or parameter-based.
|
||||
exec { 'psql_create':
|
||||
command => 'sudo -u postgres psql -d explaind < /vagrant/sql/create.sql'
|
||||
command => sprintf("sudo -u postgres psql -d explaind < %s/sql/create.sql", $PROJECT_DIR)
|
||||
}
|
||||
exec { 'psql_apply_patches':
|
||||
command => 'ls -1 /vagrant/sql/patch-???.sql | sort | xargs -n1 sudo -u postgres psql -d explaind -q -f'
|
||||
command => sprintf("ls -1 %s/sql/patch-???.sql | sort | xargs -n1 sudo -u postgres psql -d explaind -q -f", $PROJECT_DIR)
|
||||
}
|
||||
exec { 'psql_grant':
|
||||
command => 'sudo -u postgres psql -d explaind -c "grant all on plans, users to explaind;"'
|
||||
}
|
||||
|
||||
exec { 'run_daemon': command => 'hypnotoad /vagrant/explain.pl > /dev/null 2> /dev/null &' }
|
||||
exec { 'run_daemon': command => sprintf("hypnotoad %s/explain.pl > /dev/null 2> /dev/null &", $PROJECT_DIR) }
|
||||
|
||||
|
||||
package { 'curl': # required by cpanminus installation
|
||||
|
Loading…
x
Reference in New Issue
Block a user