Node.js app not changing - node.js

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

Related

create(clone) the same app for development in heroku

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/

How can I clone a git repository on a server automatically to another folder on every commit

I have a simple express.js-powered API running on an ubuntu server with pm2. The server.js and the other files are in /var/www/node/api/.
On this server, at /srv/git-repos/api.git/ is my git repository, where I commit new changes from my local machine.
The Question is, is it possible, that every time I commit new changes to the server, it recognizes this, and clones my repository to let's say /var/www/node/api-dev/(which will then be available at dev.example.com, this could be made possible with nginx, so there is no problem) and restarts my pm2 instance with pm2 restart api.
Because then I would test, if my changes work on the server, and when they do, I just can copy the content of /var/www/node/api-dev to /var/www/node/api manually.
Or is there another, better workflow? It's just a small API on which I will make many changes because I want to develop it for the needs of my frontend.
Thanks for your answers and suggestions, I hope it's understandable what I want to archive.
git commit
git clone <repo> ../api-dev
pm2 restart api
Save it as c.sh and run with ./c.sh or add to your .bashrc

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

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.

Resources