How to copy rails application using git and deployed to geroku

I am new to programming and rails and I would like to create a copy of the rails application that I work with so that I can try some things without problems. Is there an easy way to do this?

+3
source share
1 answer

Yes, you can. These commands were not obvious to beginners like me, and can help someone else ...

First, depending on what you plan to call in the newly deployed application, find the name that is currently available on heroku.

From the root of the old and newly created rails application:

$ cp -R old_directory new_directory
$ cd new_directory
$ rm -rf .git
# find and replace all references to old_director found within new_directory
# the command at the terminal 'grep -ri "old_director" .' may help to locate 
# all of the references to the old_directory
$ git init
$ git add .
$ git ci -am "First commit after copying from old_app"
# create new_directory repository at github.  Follow along their 
# directions for new repository with appropriate modifications.  
$ git remote add origin git@github.com:[github username]/[new_directory].git
$ git push -u origin master
$ rake db:migrate
$ heroku create [new_app]
$ git push heroku master

To create a new secret key for a new application:

$ rake secret  # generate new secret key for new app
5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8

Heroku :

$ heroku config:set SECRET_KEY_BASE=5ed8c7d9a3bda9cec3887b61f22aa95bf430a3a550407642b96751c7ef0ce8946a161506d6739da0dcaaea8c8f4f8b3335b1fb549e3cc54f0a4cec554ede05f8

.., Daniel Fone Blog.

:

$ heroku run rake db:migrate
+9

Source: https://habr.com/ru/post/1540061/


All Articles