-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_store.sh
55 lines (40 loc) · 1.2 KB
/
create_store.sh
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
#!/bin/bash
# Script for RoR website deployment on Heroku
# Note that Heroku only supports Postgres databases
# Assumes that the Heroku tool is installed and the user is logged
# and the App is on github
# Arguments:
# $1 -> the store name
# $2 -> the store id
# $3 -> the custom domain, if wanted
# The store directory
STORE_NAME=$2"_"$1
DIR="../plazr_stores/"$STORE_NAME
NUM_DYNOS=1
LOG_FILE="log.txt"
DEFAULT_REPO="[email protected]:Plazr/plazr_store_template.git"
echo "Progress log can be checked in $LOG_FILE"
#git clone $DEFAULT_REPO $DIR >> $LOG_FILE
mkdir $DIR
cp -R ../plazr_stores/plazr_store_template/* $DIR
cd $DIR
touch $LOG_FILE
export BUNDLE_GEMFILE=$PWD"/Gemfile"
bundle
# App creation on Heroku
# Missing app name availability check
heroku create $1 >> $LOG_FILE
# Deploys the App on Heroku
git push heroku master >> $LOG_FILE
# Scales the dyno run the webapp
heroku ps:scale web=$NUM_DYNOS >> $LOG_FILE
# Adding a custom domain
# Create subdomain on Gandi.net and associates it to heroku
if [ ! -z "$3" ]
then
heroku domains:add $3 >> $LOG_FILE
# else
# aqui e que nao sei como sera
#heroku domains:add "www.plazr.net/store/"$2 > $LOG_FILE
fi
echo "Setup of the $1 store is finished."