खोज…


आपके आवेदन की तैनाती

सुनिश्चित करें कि आप उस निर्देशिका में हैं जिसमें आपका रेल एप्लिकेशन है, फिर हरोकू पर एक ऐप बनाएं।

$ heroku create example
Creating ⬢ example... done
https://example.herokuapp.com/ | https://git.heroku.com/example.git

Ouput का पहला URL, http://example.herokuapp.com , वह स्थान है जिस पर ऐप उपलब्ध है। दूसरा URL, [email protected]: example.git, रिमोट गिट रिपॉजिटरी URL है।

इस आदेश का उपयोग केवल आरंभिक गिट रिपॉजिटरी पर किया जाना चाहिए। हरोकू कमांड स्वचालित रूप से इस URL की ओर इशारा करते हुए "हरोकू" नाम से एक git रिमोट जोड़ता है।

एप्लिकेशन नाम तर्क ("उदाहरण") वैकल्पिक है। यदि कोई ऐप नाम निर्दिष्ट नहीं है, तो एक यादृच्छिक नाम उत्पन्न होगा। चूंकि हरोकू ऐप नाम एक वैश्विक नामस्थान में हैं, आप उम्मीद कर सकते हैं कि "ब्लॉग" या "विकी" जैसे सामान्य नाम पहले से ही ले लिए जाएंगे। डिफ़ॉल्ट नाम से शुरू करना और बाद में ऐप का नाम बदलना आसान है।

अगला, अपना कोड तैनात करें:

$ git push heroku master
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.1
remote: -----> Installing dependencies using bundler 1.11.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching version metadata from https://rubygems.org/...
remote:        Fetching dependency metadata from https://rubygems.org/..
remote:        Installing concurrent-ruby 1.0.2
remote:        Installing i18n 0.7.0
remote:        Installing rake 11.2.2
remote:        Installing minitest 5.9.0
remote:        Installing thread_safe 0.3.5
remote:        Installing builder 3.2.2
remote:        Installing mini_portile2 2.1.0
remote:        Installing erubis 2.7.0
remote:        Installing pkg-config 1.1.7
remote:        Installing rack 2.0.1
remote:        Installing nio4r 1.2.1 with native extensions
remote:        Installing websocket-extensions 0.1.2
remote:        Installing mime-types-data 3.2016.0521
remote:        Installing arel 7.0.0
remote:        Installing coffee-script-source 1.10.0
remote:        Installing execjs 2.7.0
remote:        Installing method_source 0.8.2
remote:        Installing thor 0.19.1
remote:        Installing multi_json 1.12.1
remote:        Installing puma 3.4.0 with native extensions
remote:        Installing pg 0.18.4 with native extensions
remote:        Using bundler 1.11.2
remote:        Installing sass 3.4.22
remote:        Installing tilt 2.0.5
remote:        Installing turbolinks-source 5.0.0
remote:        Installing tzinfo 1.2.2
remote:        Installing nokogiri 1.6.8 with native extensions
remote:        Installing rack-test 0.6.3
remote:        Installing sprockets 3.6.3
remote:        Installing websocket-driver 0.6.4 with native extensions
remote:        Installing mime-types 3.1
remote:        Installing coffee-script 2.4.1
remote:        Installing uglifier 3.0.0
remote:        Installing turbolinks 5.0.0
remote:        Installing activesupport 5.0.0
remote:        Installing mail 2.6.4
remote:        Installing globalid 0.3.6
remote:        Installing activemodel 5.0.0
remote:        Installing jbuilder 2.5.0
remote:        Installing activejob 5.0.0
remote:        Installing activerecord 5.0.0
remote:        Installing loofah 2.0.3
remote:        Installing rails-dom-testing 2.0.1
remote:        Installing rails-html-sanitizer 1.0.3
remote:        Installing actionview 5.0.0
remote:        Installing actionpack 5.0.0
remote:        Installing actionmailer 5.0.0
remote:        Installing railties 5.0.0
remote:        Installing actioncable 5.0.0
remote:        Installing sprockets-rails 3.1.1
remote:        Installing coffee-rails 4.2.1
remote:        Installing jquery-rails 4.1.1
remote:        Installing rails 5.0.0
remote:        Installing sass-rails 5.0.5
remote:        Bundle complete! 15 Gemfile dependencies, 54 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into ./vendor/bundle.
remote:        Bundle completed (31.86s)
remote:        Cleaning up the bundler cache.
remote:        Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        I, [2016-07-08T17:08:57.046245 #1222]  INFO -- : Writing /tmp/build_49ba6c877f5502cd4029406e981f90b4/public/assets/application-1bf5315c71171ad5f9cbef00193d56b7e45263ddc64caf676ce988cfbb6570bd.js
remote:        I, [2016-07-08T17:08:57.046951 #1222]  INFO -- : Writing /tmp/build_49ba6c877f5502cd4029406e981f90b4/public/assets/application-1bf5315c71171ad5f9cbef00193d56b7e45263ddc64caf676ce988cfbb6570bd.js.gz
remote:        I, [2016-07-08T17:08:57.060208 #1222]  INFO -- : Writing /tmp/build_49ba6c877f5502cd4029406e981f90b4/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css
remote:        I, [2016-07-08T17:08:57.060656 #1222]  INFO -- : Writing /tmp/build_49ba6c877f5502cd4029406e981f90b4/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz
remote:        Asset precompilation completed (4.06s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote:
remote: ###### WARNING:
remote:        No Procfile detected, using the default web server.
remote:        We recommend explicitly declaring how to boot your server process via a Procfile.
remote:        https://devcenter.heroku.com/articles/ruby-default-web-server
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> console, rake, web, worker
remote:
remote: -----> Compressing...
remote:        Done: 29.2M
remote: -----> Launching...
remote:        Released v5
remote:        https://example.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/example.git
 * [new branch]      master -> master

यदि आप अपने एप्लिकेशन में डेटाबेस का उपयोग कर रहे हैं, तो आपको मैन्युअल रूप से डेटाबेस को चलाने की आवश्यकता है:

$ heroku run rake db:migrate

heroku run बाद किसी भी कमांड को heroku run पर निष्पादित किया जाएगा। आप चलाकर एक इंटरैक्टिव शेल सत्र प्राप्त कर सकते हैं:

$ heroku run bash

सुनिश्चित करें कि आपके पास वेब प्रक्रिया प्रकार चलाने वाला एक डायनो है:

$ heroku ps:scale web=1

हरको पीएस कमांड आपके एप्लिकेशन के रनिंग डायनोस को सूचीबद्ध करता है:

$ heroku ps
=== web (Standard-1X): bin/rails server -p $PORT -e $RAILS_ENV (1)
web.1: starting 2016/07/08 12:09:06 -0500 (~ 2s ago)

अब आप हमारे ब्राउज़र में ऐप को heroku open साथ heroku open

$ heroku open

herokuapp.com डोमेन में एक डिफ़ॉल्ट वेब URL देता है। जब आप उत्पादन के लिए बड़े पैमाने पर तैयार होते हैं, तो आप अपना स्वयं का कस्टम डोमेन जोड़ सकते हैं।

एक हेरोकू के लिए उत्पादन और मचान वातावरण का प्रबंधन

हर हरोकू ऐप कम से कम दो वातावरण में चलता है: हरोकू पर (हम उस उत्पादन को कॉल करेंगे) और आपके स्थानीय मशीन (विकास) पर। यदि एक से अधिक व्यक्ति ऐप पर काम कर रहे हैं, तो आपको कई विकास परिवेश मिले हैं - एक प्रति मशीन, आमतौर पर। आमतौर पर, प्रत्येक डेवलपर के पास परीक्षण चलाने के लिए एक परीक्षण वातावरण भी होगा। दुर्भाग्य से, यह दृष्टिकोण टूट जाता है क्योंकि वातावरण कम समान हो जाता है। उदाहरण के लिए, विंडोज और मैक, दोनों ही हरोकू पर लिनक्स स्टैक की तुलना में अलग-अलग वातावरण प्रदान करते हैं, इसलिए आप हमेशा यह सुनिश्चित नहीं कर सकते हैं कि आपके स्थानीय विकास वातावरण में काम करने वाला कोड उसी तरह काम करेगा जब आप इसे उत्पादन में तैनात करते हैं।

समाधान के लिए एक मचान वातावरण है जो उत्पादन के समान है और संभव है। यह एक दूसरा हरोकू एप्लिकेशन बनाकर प्राप्त किया जा सकता है जो आपके स्टेजिंग एप्लिकेशन को होस्ट करता है। मंचन के साथ, आप अपने वास्तविक उपयोगकर्ताओं को प्रभावित करने से पहले अपने कोड को उत्पादन जैसी सेटिंग में देख सकते हैं।

आरंभ से शुरुआत करते हुए

मान लें कि आपके पास अपने स्थानीय मशीन पर एक एप्लिकेशन चल रहा है, और आप इसे हरोकू पर धकेलने के लिए तैयार हैं। हमें दूरस्थ वातावरण, मंचन और उत्पादन दोनों बनाने की आवश्यकता होगी। पहले मंचन करने के लिए धक्का देने की आदत में लाने के लिए, हम इसके साथ शुरू करेंगे:

$ heroku create --remote staging
Creating strong-river-216.... done
http://strong-river-216.heroku.com/ | https://git.heroku.com/strong-river-216.git
Git remote staging added

डिफ़ॉल्ट रूप से, हरोकू सीएलआई एक हेरोकू गिट रिमोट के साथ प्रोजेक्ट बनाता है। यहां, हम - theremote ध्वज के साथ एक अलग नाम निर्दिष्ट कर रहे हैं, इसलिए कोड को हरोकू पर धकेलना और ऐप के खिलाफ कमांड चलाना सामान्य git पुश हर्को मास्टर की तुलना में थोड़ा अलग दिखता है:

 $ git push staging master
...
 $ heroku ps --remote staging
=== web: `bundle exec puma -C config/puma.rb``
web.1: up for 21s

एक बार आपका स्टेजिंग ऐप ठीक से चल रहा है और आप अपना प्रोडक्शन ऐप बना सकते हैं:

$ heroku create --remote production
Creating fierce-ice-327.... done
http://fierce-ice-327.heroku.com/ | https://git.heroku.com/fierce-ice-327.git
Git remote production added
$ git push production master
...
$ heroku ps --remote production
=== web: `bundle exec puma -C config/puma.rb
web.1: up for 16s

और इसके साथ, आपको एक ही कोडबेस दो अलग-अलग हेरोकू ऐप के रूप में चल रहा है - एक स्टेजिंग और एक प्रोडक्शन, जो कि समान रूप से स्थापित है। बस याद रखें कि आपको यह निर्दिष्ट करना होगा कि आप अपने दैनिक कार्य पर कौन सा ऐप संचालित करने जा रहे हैं। आप डिफ़ॉल्ट ऐप को निर्दिष्ट करने के लिए या तो ध्वज '- श्मशान' का उपयोग कर सकते हैं या अपने गिट विन्यास का उपयोग कर सकते हैं।



Modified text is an extract of the original Stack Overflow Documentation
के तहत लाइसेंस प्राप्त है CC BY-SA 3.0
से संबद्ध नहीं है Stack Overflow