Skip to content

Commit f500404

Browse files
Update server.md
1 parent a825746 commit f500404

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

development/server.md

+23-16
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,8 @@ Veritabanı sunucunuz da hazırlandıktan sonra artık rails application'ununuz
269269
Gemleri kurduktan sonra `capify .` komutunu çalıştıralım. Oluşan `config/deploy.rb` dosyasını aşağıdaki gibi düzenleyelim.
270270
271271
```ruby
272-
# -*- encoding : utf-8 -*-
273272
require "bundler/capistrano"
274-
require "whenever/capistrano"
275-
273+
#require "whenever/capistrano"
276274

277275
set :stages, %w(staging production)
278276
set :default_stage, "production"
@@ -340,7 +338,7 @@ namespace :deploy do
340338

341339
desc "Update the crontab file"
342340
task :update_crontab, :roles => :db do
343-
run "cd #{release_path} && whenever --update-crontab #{application}"
341+
#run "cd #{release_path} && whenever --update-crontab #{application}"
344342
end
345343
after "deploy:update_crontab", "deploy:resque_setup"
346344

@@ -368,11 +366,10 @@ set :rails_env, 'production'
368366
namespace :deploy do
369367
task :setup_config, roles: :app do
370368
# Production
371-
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
372-
369+
sudo "ln -nfs #{current_path}/config/nginx.#{rails_env}.conf /etc/nginx/sites-enabled/#{application}"
373370
sudo "ln -nfs #{current_path}/config/unicorn_init_#{rails_env}.sh /etc/init.d/unicorn_#{application}"
374371
run "mkdir -p #{shared_path}/config"
375-
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
372+
put File.read("config/database.example.#{rails_env}.yml"), "#{shared_path}/config/database.yml"
376373
puts "Now edit the config files in #{shared_path}."
377374
end
378375
end
@@ -386,26 +383,36 @@ set :rails_env, 'staging'
386383
namespace :deploy do
387384
task :setup_config, roles: :app do
388385
# Staging
389-
sudo "ln -nfs #{current_path}/config/nginx.conf /etc/nginx/sites-enabled/#{application}"
390-
386+
sudo "ln -nfs #{current_path}/config/nginx.#{rails_env}.conf /etc/nginx/sites-enabled/#{application}"
391387
sudo "ln -nfs #{current_path}/config/unicorn_init_#{rails_env}.sh /etc/init.d/unicorn_#{application}"
392388
run "mkdir -p #{shared_path}/config"
393-
put File.read("config/database.example.yml"), "#{shared_path}/config/database.yml"
389+
put File.read("config/database.example.#{rails_env}.yml"), "#{shared_path}/config/database.yml"
394390
puts "Now edit the config files in #{shared_path}."
395391
end
396392
end
397393
```
398394
399-
Gemfile a `gem 'unicorn'` ekleyelim. `config/unicorn_init_production` ve `config/unicorn_init_staging` dosyalarını oluşturalım. Dosyaları şu şekilde güncelleyelim.
395+
Gemfile a `gem 'unicorn'` ekleyelim. `config/unicorn_init_production.sh` ve `config/unicorn_init_staging.sh`
396+
dosyalarını oluşturalım. Dosyaları şu şekilde güncelleyelim.
400397
401398
* https://gist.github.com/muhammetdilek/d45a30d5fd26889ef5ea
402399
* https://gist.github.com/muhammetdilek/d37e6b31d1b02e652255
403400
404-
`project_name` kısmını proje ismiyle değiştiriniz.
401+
Bu dosyalardan `project_name` kısmını proje ismiyle değiştirmeyi unutmayınız.
402+
403+
Ardından yukarıdaki dosyaları çalıştırılabilir hale getirmek için, aşağıdakı komutu konsoldan çalıştırın.
404+
405+
```bash
406+
$ chmod +x config/unicorn_init_production.sh && chmod +x config/unicorn_init_staging.sh
407+
```
408+
Ardından;
405409
406-
`config/database.example.yml` dosyasını oluşturup sunucu için kullancağınız veritabnı bilgilerini yazınız.
410+
`config/database.example.staging.yml` ve `config/database.example.production.yml` dosyalarını oluşturup
411+
staging ve production sunucu için kullancağınız veritabanı bilgilerini ilgili environment değerleri ile oluşturunuz.
407412
408-
`config/nginx.conf` dosyasını oluşturup aşağıdaki gibi güncelleyiniz.
413+
`config/nginx.staging.conf` ve `config/nginx.production.conf` dosyasını oluşturup aşağıdaki gibi güncelleyiniz.
414+
Bu aşamada eğer staging ve production sunucularında farklı nginx ayarları yapmak isterseniz dosyaları modifiye edebilirsiniz.
415+
Örneğin. Staging sunucu icin domain sadece ```stage.example.com``` şeklinde kullanılabilir.
409416
410417
```shell
411418
upstream project_name {
@@ -437,9 +444,9 @@ Gemfile a `gem 'unicorn'` ekleyelim. `config/unicorn_init_production` ve `config
437444
}
438445
```
439446
440-
`project_name` olan yerleri değiştirmeyi unutmayınız.
447+
`project_name` olan yerleri proje ismi ile değiştirmeyi unutmayınız.
441448
442-
Artık deploy için herşeyimiz hazır.
449+
Artık deploy için hazırız.
443450
444451
Proje dizininde;
445452

0 commit comments

Comments
 (0)