create(clone) the same app for development in heroku - node.js

I am having the app http://example.com in heroku. So I need to create(clone) the same app for my development in subfolder http://example.com/subfolder. How to do this. Any help will be much appreciated.
Note:
I am having only heroku access, no domain login available with me.
Heroku nodejs application.
I am new to Heroku. I have clonned the same app in my localhost:5000. But needed online development environment.

Finally I created the staging environment. My development environment is in local.
Once I clone my production app to my local, then I am creating the staging environment.
ref this link for downloading code from heroku. Ensure that you have downloaded the application slugs.
Once cloned into my local. I checked with localhost:5000. For this I have already installed node server and git in my windows 10.
heroku create --remote staging
after the above command, you will see the new staging environment(name will be auto generated) created in your Heroku login.
Click on that newly created app name in heroku login and then deploy tab, follow the procedure given in that. for which the link can be like this https://dashboard.heroku.com/apps/autogenerated-appname-12345/deploy/heroku-git
And in the final step git push heroku master I got the error
fatal: 'heroku' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Then I used git push staging master which is mentioned in this document.
Then I checked in the browser https://autogenerated-appname-12345.herokuapp.com/

Related

Why is my app still displaying old code after generating new app?

I deployed my app like a month ago, and everything was working OK.
In the meantime my app changed a lot so I decided to deploy new version.
I used command git push heroku deployment:master (git branch deployment is containing some files just for deployment).
When I opened my app via heroku open I noticed that my app is still using old home page. After Googling around I've tried:
heroku reset
Creating new branch and pushing new code with few test lines added
Try to clear cache, open pages in different browsers
Checking the files with heroku run bash (all files are as they should be)
I went even further and tried:
heroku apps:destroy
heroku create (created new project, and used git push heroku deployment:master again)
Event after accessing the new URL, there is still old code, old .html pages and everything. I'm using Node.js v8.11.4
Help me out please! Thanks in addition.
EDIT: Was trying also to git clone Heroku Git URL, to my desktop. All files are as expected, I have no idea, where is heroku getting old files...
After 2 days of fooling around and trying a lot of different things there were 2 things that I need to do.
Don't forget to run ng build before deploying new version of app, or else old public files will be deployed
Clear the build cache for an app using the following commands:
heroku plugins:install heroku-repo
heroku repo:purge_cache -a appname
git commit --allow-empty -m "Purge cache"
git push heroku master
Where appname is replaced by the name of the app you want to clear the cache for.
SOURCE: How to clear build cache

heroku git dependency propagation

In my heroku app repo, we have git dependency
"allcountjs" : "git+https://gitlab.com/ourawesome/allcountjs.git#Print
I have made some changes to this repo (allcountjs ) and i want them reflected to my heroku app.
I did a git pull / git push on heroku and it seemed to have successfully deployed the app. Alas, I don't see the changes when i access the app on web.
Any idea why?
How can I force a node restart on a heroku app?
I hope it s clear. Thanks in advance.
It is more like NPM issue than Heroku. Try putting the commit id instead of branch in the url of dependency, e.g.:
"dependency" : "git+https://gitlab.com/ourawesome/allcountjs.git#e1111a0a4cf50ae6ef1dde4c22b87d833e26befa"
So that NPM knows that it was updated

Node.js app not changing

I have a node app running on my VS using pm2, deployed via git.
All works fine, but when I make changes in my local version and then push it to the server the files are changed and updated to the new version, but the app still looks like the same of the initial push I made when I deployed it for the first time. Pm2 is set to watch for changes and in my local version all works fine, while on Vs not.
How is that possible?
UPDATE
Apparently it's just the .js file that isn't changed, html are fine.
Apperently a rebase fixeded the problem:
git pull --rebase origin master
git push -u origin master

Ghost(node.js) app - 503 err after git push in OpenShift hosting

I created ghost blog in OpenShift host. Everything worked fine.
I wanted to make some changes in css file(change the margin of the page title), so i did git pull the resources, made changes in css file locally, and git push back with command git push -f(force) openshift master, because without -f, I couldn't do this push.
After this "git push" command, my app got broke, and now, the http outputs 503 error...
I tried to restart my app, but it doesn't help. Don't know why it crashed.
Not sure what actually happened with your new change.Check the app logs.
First ssh to your app
ssh 1234567890abcdef1234567890abcdef#your-app-domain.rhcloud.com
and then cd to logs directory
cd app-root/logs
tail the contents of nodejs.log file
This may not actually resolve your issue but logs can help you.

Development build of my Node.js site

I have a production build of my site on a VPS, and I deploy to a bare git repo which has a hook that checkouts the commits to an app directory. I use forever to keep my app running from the app directory.
What I want to do is set up a development build which I can push to. The development build could be hosted under a subdomain on my VPS. However, I'll need an authentication step that'll prevent anyone and everyone from accessing the development site. How could I put authentication in front of an entire site with little (if any) changes to my application?
Why don't you just run it on a port that isn't available to the public and then you could create an ssh tunnel and access it via localhost?
Add a dev ssh user to your VPS and assign it a password.
Your ssh tunnel would look like this (just adjust your ports accordingly):
ssh -N -L8808:localhost:8808 user#destination.com
You'll be prompted for your password and then you would leave your terminal session open and go to your dev server via "http://localhost:8808"
Another option (something I typically do). Is to have a file checked into your repo named "config.sample.json" with configuration information (in this case your username/password [development] restriction). Then you also set up git to ignore "config.json" (so you don't accidentally commit this to your repository and have to edit files on your production deployments).
Next you would write a function that would require that config.json file and use it's configuration data if the file is found otherwise it would load up as "production".
Then you would deploy your code to your development directory and afterward rename your "config.sample.json" to "config.json" and make any edits that were needed in that file to setup debugging, access control, etc.

Resources