mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-17 06:52:27 +01:00
Use the default database config file to reduce duplication
This commit is contained in:
parent
fbf5edb64a
commit
304abff919
2
Vagrantfile
vendored
2
Vagrantfile
vendored
@ -30,7 +30,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
||||
config.vm.synced_folder '.', '/vagrant', type: 'virtualbox'
|
||||
|
||||
# Copy default configuration files for the database conenction and the Rails application
|
||||
config.vm.provision "file", source: "./config/database.yml.virtual", destination: "/vagrant/config/database.yml"
|
||||
config.vm.provision "file", source: "./config/database.yml.default", destination: "/vagrant/config/database.yml"
|
||||
config.vm.provision "file", source: "./config/application.yml.default", destination: "/vagrant/config/application.yml"
|
||||
|
||||
## Provision software dependencies
|
||||
|
@ -1,28 +0,0 @@
|
||||
development: &development
|
||||
adapter: postgresql
|
||||
host: localhost
|
||||
encoding: unicode
|
||||
database: fabmanager_development
|
||||
pool: 25
|
||||
username: ubuntu
|
||||
password: ubuntu
|
||||
|
||||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
<<: *development
|
||||
database: fabmanager_test
|
||||
|
||||
production: &production
|
||||
adapter: postgresql
|
||||
host: ENV['DATABASE_HOST']
|
||||
encoding: unicode
|
||||
database: fabmanager_production
|
||||
pool: 25
|
||||
username: ENV['DATABASE_USER']
|
||||
password: ENV['DATABASE_PASS']
|
||||
|
||||
staging:
|
||||
<<: *production
|
||||
database: fabmanager_staging
|
@ -27,7 +27,7 @@ install_postgres() {
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y postgresql postgresql-contrib
|
||||
|
||||
# Set up ubuntu user
|
||||
# Set up ubuntu user for Postgres
|
||||
sudo -u postgres bash -c "psql -c \"CREATE USER ubuntu WITH PASSWORD 'ubuntu';\""
|
||||
sudo -u postgres bash -c "psql -c \"ALTER USER ubuntu WITH SUPERUSER;\""
|
||||
|
||||
@ -37,6 +37,10 @@ install_postgres() {
|
||||
|
||||
# Start service
|
||||
sudo service postgresql start
|
||||
|
||||
# Replace default database user in the app database configuration
|
||||
sed -i 's@username: postgres@username: ubuntu@g' /vagrant/config/database.yml
|
||||
sed -i 's@password: postgres@password: ubuntu@g' /vagrant/config/database.yml
|
||||
}
|
||||
|
||||
###
|
||||
@ -69,6 +73,9 @@ install_elasticsearch() {
|
||||
|
||||
sudo /bin/systemctl daemon-reload
|
||||
sudo /bin/systemctl enable elasticsearch.service
|
||||
|
||||
# Create pids directory for Sidekick
|
||||
sudo mkdir -p /vagrant/tmp/pids
|
||||
}
|
||||
|
||||
###
|
||||
@ -158,35 +165,6 @@ install_ruby() {
|
||||
rvm cleanup all
|
||||
}
|
||||
|
||||
###
|
||||
# Tune-up the system settings
|
||||
system_tuning()
|
||||
{
|
||||
echo "Tunning up the system"
|
||||
|
||||
# Create pids directory for Sidekick
|
||||
sudo mkdir -p /vagrant/tmp/pids
|
||||
|
||||
# Enable overcomit memmory for Redis
|
||||
sudo echo -e "\n## Redis tune-up" >> /etc/sysctl.conf
|
||||
sudo echo '# Allow background save on low memory conditions' >> /etc/sysctl.conf
|
||||
sudo echo -e "vm.overcommit_memory = 1\n" >> /etc/sysctl.conf
|
||||
|
||||
# Enagle huge pages for Redis
|
||||
sudo touch /etc/rc.local
|
||||
sudo echo '## Redis tune-up' >> /etc/rc.local
|
||||
sudo echo '# Reduce latency and memory usage' >> /etc/rc.local
|
||||
sudo echo 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' >> /etc/rc.local
|
||||
sudo echo -e "\n\n"
|
||||
sudo echo -e "exit 0\n" >> /etc/rc.local
|
||||
sudo chmod +x /etc/rc.local
|
||||
|
||||
# Increase virtual memory areas for ElasticSearch
|
||||
sudo echo -e "\n## ElasticSearch tune-up" >> /etc/sysctl.conf
|
||||
sudo echo '# Increase max virtual memory areas' >> /etc/sysctl.conf
|
||||
sudo echo -e "vm.max_map_count = 262144\n" >> /etc/sysctl.conf
|
||||
}
|
||||
|
||||
###
|
||||
# Remove unused software
|
||||
clean_up() {
|
||||
@ -206,7 +184,6 @@ setup() {
|
||||
install_yarn
|
||||
install_rvm
|
||||
install_ruby
|
||||
system_tuning
|
||||
clean_up
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user