-
Notifications
You must be signed in to change notification settings - Fork 1
/
heroku git
329 lines (242 loc) · 9 KB
/
heroku git
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
Heroku setup
==========================================================
rvm gem install heroku -v=1.20.1
heroku keys:add
cd hellow_world # go to application folder
git init
git add .
git commit -m "initial import" .
heroku create sandiphero1
git push heroku master
heroku rake db:migrate
#after every changes first commit it
git commit -m "rake use" .
git push heroku master
#merging github code to existing heroku application
go to applicaion
git remote add heroku [email protected]:solrsystem.git #heroku github
git remote -v
git push heroku master
#Heroku information
heroku config
heroku info
Q.How to copy from one heroku database to local database
A. http://blog.heroku.com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku/
heroku db:pull
heroku db:push
Q. heroku database updatation
A. https://addons.heroku.com/heroku-postgresql
note
------------
git clone -o heroku [email protected]:sandiphero1.git #clone repository to your local computer
heroku login # create an credential to your local computer
heroku logout #remove credential
heroku info #information on repository
heroku sharing add [email protected] #invite to other user for collaborating your
application
heroku logs
heroku addons
heroku rename newname
problem
==================================================
git clone [email protected]:aox-production.git -o heroku
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
heroku login
ssh-keygen -t rsa -C "[email protected]"
heroku keys:add
git clone [email protected]:aox-production.git -o heroku
Q. Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.)
Tasks: TOP => db:create
(See full trace by running task with --trace)
A.
group :production do
gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too
gem 'pg'
end
Q. how to clear database on heroku
A. heroku pg:reset SHARED_DATABASE
heroku run rake db:create
Q. how to back up heroku database
A. heroku pgbackups:capture
Q. List of pgback up
A. heroku pgbackups
Q. saved database location
A. heroku pgbackups:url b001
Q. Heroku data store into database
heroku pgbackups:url b001
A. heroku pgbackups:restore DATABASE "https://s3.amazonaws.com/hkpgbackups/[email protected]/b001.dump?AWSAccessKeyId=AKIAIYZ2BP3RBVXEIZDA&Expires=1344446375&Signature=dv2EWvhzvStvdS3OExqnVM6xmtM%3D"
for HEROKU_POSTGRESQL_WHITE
heroku pgbackups:restore HEROKU_POSTGRESQL_WHITE "https://s3.amazonaws.com/hkpgbackups/[email protected]/b005.dump?AWSAccessKeyId=AKIAIYZ2BP3RBVXEIZDA&Expires=1345086066&Signature=RGXNCa5GerfXmvBomw3qBC3mZjo%3D"
A. heroku pgbackups:restore DATABASE b003
Q. github push
A. git push origin master
Q Heroku push
git push heroku master
Heroku on staging server
============================================
heroku create --remote staging
git push staging master
heroku run rake db:migrate --remote staging
heroku ps --remote staging
HEROKU LOGIN FROM OFFICE COMPUTER
=====================================================
remove apt.conf from /etc/apt
unset http_proxy
export http_proxy=http://sandip_mondal:'s1234567l!'@puneproxy.persistent.co.in:8080/
heroku login: [email protected]
password:
! Push rejected, no Cedar-supported app detected
==========================================================
First check Gemfile, Is there any gem which is dependent on system then remove the file
heroku create --stack cedar
Capistrano Setup
============================================================
rvm gem install capistrano
capify .
config/deploy.rb
set :application, "hello"
set :repository, "[email protected]:smondal/hello-world.git"
set :scm, :git
set :scm_username, "[email protected]"
set :scm_password, '29152808'
set :scm_verbose, true
set :deploy_via, :remote_cache #for git it will deploy very soon full reposity clone every time
server "180.215.176.60", :app, :web, :db, :primary => true
set :user, "user" #machine user name
set :password, "passw0rd"
set :deploy_to, "/home/user/#{application}"
set :current_path, "#{deploy_to}/current"
set :releases_path, "#{deploy_to}/releases"
set :shared_path, "#{deploy_to}/shared"
set :use_sudo, false
set :branch, "master"
set :deploy_env, "development"
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
# role :web, "your web-server here" # Your HTTP server, Apache/etc
# role :app, "your app-server here" # This may be the same as your `Web` server
# role :db, "your primary db-server here", :primary => true # This is where Rails migrations will run
# role :db, "your slave db-server here"
# if you're still using the scr ipt/reaper helper you will need
# these http://github.com/rails/irs_process_scripts
# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
task :start do ; end
task :stop do ; end
task :restart, :roles => :app, :except => { :no_release => true } do
run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
end
end
Nginx setup
===========================================================
rvm gem install passenger
passenger-install-nginx-module
sudo apt-get install libcurl4-openssl-dev
rvm 1.9.2 --passenger
rvm 1.9.2
gem install passenger
rvmsudo passenger-install-nginx-module
sudo -R 777 /opt/nginx/sbin/nginx # give the permission to nginx folde
sudo chmod -R 777 /opt/nginx/conf/nginx.conf # give the conf file permission
tail -f /opt/nginx/logs/error.log # show the log file
pkill nginx # kill the nginx process
/opt/nginx/sbin/nginx # start enginx
vi /opt/nginx/conf/nginx.conf #
#user nobody;
#user www;
worker_processes 1;
error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
passenger_root /home/user/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.8;
passenger_ruby /home/user/.rvm/wrappers/ruby-1.9.2-p290/ruby;
passenger_max_pool_size 10;
# access_log logs/localhost.access.log main;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
server {
listen 8080;
server_name localhost;
# access_log logs/domain2.access.log main;
root /home/user/hello_world/public;
# root /home/user/project/db
passenger_enabled on;
passenger_use_global_queue on;
rails_env development;
#charset koi8-r;
#access_log logs/host.access.log main;
# location / {
# root html;
# index index.html index.htm;
# }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443;
# server_name localhost;
# ssl on;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_timeout 5m;
# ssl_protocols SSLv2 SSLv3 TLSv1;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}