-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
installation via RVM #10
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9ff5cae
installation via RVM
tuxmea 29e98fd
use rvm for hdm installation
tuxmea 1a193d1
lint fixes
tuxmea d2d2298
rubocop fixes
tuxmea f134bd4
use rvm prior runing bundler
tuxmea 46eecaf
use rvm path
tuxmea baf3dca
centos 7 needs g++ from scl
tuxmea b44710b
centos 7 needs newer sqlite
tuxmea a87e66c
sqlite updating needs exec
tuxmea 7c5ffba
fix rvm do call
tuxmea 185f616
add rvm to systemd unit file
tuxmea 041aa26
set systemd env
tuxmea 8193b0a
set systemd env
tuxmea 69268e7
add .with_all_deps to spec tests
tuxmea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# class hdm::rvm | ||
class hdm::rvm { | ||
group { $hdm::group: | ||
ensure => present, | ||
} | ||
|
||
user { $hdm::user: | ||
ensure => present, | ||
shell => '/sbin/nologin', | ||
home => $hdm::hdm_path, | ||
gid => $hdm::group, | ||
} | ||
|
||
file { $hdm::hdm_path: | ||
ensure => directory, | ||
owner => $hdm::user, | ||
group => $hdm::group, | ||
} | ||
|
||
include gnupg | ||
|
||
include rvm | ||
|
||
rvm::system_user { 'hdm': | ||
create => false, | ||
} | ||
|
||
rvm_system_ruby { "ruby-${hdm::ruby_version}": | ||
ensure => present, | ||
default_use => false, | ||
} | ||
|
||
rvm_gem { 'bundler': | ||
ensure => present, | ||
ruby_version => "ruby-${hdm::ruby_version}", | ||
require => Rvm_system_ruby["ruby-${hdm::ruby_version}"], | ||
} | ||
|
||
# Fix for old g++ and sqlite3 | ||
case $facts['os']['family'] { | ||
'RedHat': { | ||
if versioncmp($facts['os']['release']['major'], '8') < 0 { | ||
package { 'centos-release-scl': | ||
ensure => present, | ||
} | ||
|
||
package { 'devtoolset-7': | ||
ensure => present, | ||
} | ||
$exec_prefix = 'scl enable devtoolset-7 ' | ||
exec { 'update sqlite': | ||
command => 'yum install -y https://kojipkgs.fedoraproject.org//packages/sqlite/3.8.11/1.fc21/x86_64/sqlite-devel-3.8.11-1.fc21.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/sqlite/3.8.11/1.fc21/x86_64/sqlite-3.8.11-1.fc21.x86_64.rpm', | ||
path => $facts['path'], | ||
unless => 'rpm -q sqlite | grep 3.8', | ||
} | ||
} else { | ||
$exec_prefix = '' | ||
} | ||
} | ||
default: { | ||
$exec_prefix = '' | ||
} | ||
} | ||
|
||
vcsrepo { $hdm::hdm_path: | ||
ensure => present, | ||
provider => 'git', | ||
source => 'https://github.com/betadots/hdm.git', | ||
revision => $hdm::version, | ||
} | ||
|
||
exec { 'bundle config path': | ||
command => "source $(rvm ${hdm::ruby_version} do rvm env --path) && rvm ${hdm::ruby_version} do bundle config set --local path 'vendor/bundle'", | ||
cwd => $hdm::hdm_path, | ||
path => "/usr/local/rvm/bin:${facts['path']}", | ||
unless => 'grep vendor/bundle .bundle/config', | ||
provider => 'shell', | ||
} | ||
|
||
exec { 'bundle config development': | ||
command => "source $(rvm ${hdm::ruby_version} do rvm env --path) && rvm ${hdm::ruby_version} do bundle config set --local with 'development'", | ||
cwd => $hdm::hdm_path, | ||
path => "/usr/local/rvm/bin:${facts['path']}", | ||
unless => 'grep development .bundle/config', | ||
provider => 'shell', | ||
} | ||
|
||
exec { 'bundle install': | ||
command => "${exec_prefix} 'source $(rvm ${hdm::ruby_version} do rvm env --path) && rvm ${hdm::ruby_version} do bundle install --jobs $(nproc) && touch .bundle_install_finished'", | ||
cwd => $hdm::hdm_path, | ||
path => "/usr/local/rvm/bin:${facts['path']}", | ||
creates => "${hdm::hdm_path}/.bundle_install_finished", | ||
provider => 'shell', | ||
} | ||
|
||
file { "${hdm::hdm_path}/config/hdm.yml": | ||
ensure => file, | ||
content => epp('hdm/hdm.yml.epp'), | ||
} | ||
|
||
exec { 'bundle db:setup': | ||
command => "source $(rvm ${hdm::ruby_version} do rvm env --path) && rvm ${hdm::ruby_version} do bundle exec rails db:setup && touch .bundle_db_setup_finished", | ||
cwd => $hdm::hdm_path, | ||
path => "/usr/local/rvm/bin:${facts['path']}", | ||
creates => "${hdm::hdm_path}/.bundle_db_setup_finished", | ||
provider => 'shell', | ||
} | ||
|
||
exec { 'bundle rails credentials': | ||
command => "source $(rvm ${hdm::ruby_version} do rvm env --path) && rvm ${hdm::ruby_version} do echo 'secret' | EDITOR='vim' bundle exec rails credentials:edit", | ||
cwd => $hdm::hdm_path, | ||
path => "/usr/local/rvm/bin:${facts['path']}", | ||
creates => "${hdm::hdm_path}/config/credentials.yml.enc", | ||
provider => 'shell', | ||
} | ||
|
||
systemd::unit_file { 'hdm.service': | ||
content => epp('hdm/hdm.service.epp'), | ||
enable => true, | ||
active => true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'spec_helper' | ||
|
||
describe 'hdm' do | ||
on_supported_os.each do |os, os_facts| | ||
context "on #{os} using rvm" do | ||
let(:facts) { os_facts } | ||
let(:params) do | ||
{ | ||
'method' => 'rvm', | ||
} | ||
end | ||
|
||
it { is_expected.to compile } | ||
tuxmea marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
root_home: '/root' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the package resource and provide the link to the package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. we need to install both packages at once as we are upgrading from sqlite 3.7 to 3.8.