-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPortalSingularity
59 lines (54 loc) · 2.49 KB
/
PortalSingularity
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
BootStrap: docker
From: adgud2/ruby-rvm:lite
%runscript
echo "create database cbrain;" >> sqlsetup
echo "create user 'cbrain'@'127.0.0.1' identified by 'cbrain';" >> sqlsetup
echo "grant all on cbrain.* to 'cbrain'@'127.0.0.1';" >> sqlsetup
mysql -h localhost -u root --protocol tcp < sqlsetup > /dev/null
rm sqlsetup
export PATH=$PATH:/usr/local/rvm/rubies/ruby-2.2.4/bin
export PATH=$PATH:/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/gems/2.2.0/bin
cd /home/cbrain/cbrain/BrainPortal
mkdir /home/cbrain/cbrain/BrainPortal/config/initializers
cp -R /home/cbrain/cbrain/BrainPortal/config/initializers.bak/* /home/cbrain/cbrain/BrainPortal/config/initializers
bundle install
rake cbrain:plugins:install:all
rake db:schema:load RAILS_ENV=development
rake db:seed RAILS_ENV=development
rake db:sanity:check RAILS_ENV=development
rails server thin -e development -p 3000
%post
apt-get -y update
apt-get -y install debianutils coreutils openssh-client libmysqlclient-dev libxml2 libxml2-dev mysql-client && rm -rf /var/lib/apt/lists/*
mkdir -p /home/cbrain
cd /home/cbrain
git clone https://github.com/aces/cbrain.git
export PATH=$PATH:/usr/local/rvm/rubies/ruby-2.2.4/bin
echo '. /etc/profile.d/rvm.sh' >> $SINGULARITY_ENVIRONMENT
cd cbrain/BrainPortal
groupadd -g 1500 cbrain
useradd -u 1500 -g 1000 cbrain
echo 'cbrain:cbrain' | chpasswd
chown -R cbrain /home/cbrain
su cbrain -c '. /etc/profile.d/rvm.sh && rvm install 2.2.4'
chmod go+rw /usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/gems/2.2.0/cache
chmod -R go+rwX /usr/local/rvm/rubies/ruby-2.2.4/
su cbrain -c '. /etc/profile.d/rvm.sh && rvm use 2.2.4 && gem install bundler'
su cbrain -c '. /etc/profile.d/rvm.sh && rvm use 2.2.4 && bundle install'
export PATH=$PATH:/usr/local/rvm/rubies/ruby-2.2.4/lib/ruby/gems/2.2.0/bin
bundle install
cd config
cp database.yml.TEMPLATE database.yml
sed -i 's/database: cbrain_db_name_here/database: cbrain/g' database.yml
sed -i 's/username: cbrain_db_user_name_here/username: cbrain/g' database.yml
sed -i 's/password: cbrain_db_user_pw_here/password: cbrain/g' database.yml
sed -i 's/host: localhost/host: 127.0.0.1/g' database.yml
chown -R cbrain /home/cbrain/cbrain
chgrp -R cbrain /home/cbrain
chmod -R go+rwX /home/cbrain
cd /home/cbrain/cbrain/BrainPortal/config/
mv initializers initializers.bak
cd initializers.bak
cat config_portal.rb.TEMPLATE | sed 's/CBRAIN_RAILS_APP_NAME = "simple_name"/CBRAIN_RAILS_APP_NAME = "sing"/g' > config_portal.rb
cd `bundle show sys-proctable`
rake install