I have made changes to some css and js file in my Node-React apllication which is deployed on Heroku. But the changes are not showing up when I git add . the project on heroku. ALthough the changes are not coming up when I run the project locally.
Any help would be appreciated on what could be the possible cause on the changes not getting deployed?
You need a few more commands in your deployment workflow.
The git add . command is putting your local changes into staging.
You also need to run git commit -m 'your commit message' in order to commit those local changes to your local git repository.
Next, you need to run git push to push your local repository to the remote repository it is linked with.
Effective use of git is one of the most useful things you can teach yourself as a developer. It will enable you to contribute effectively to a team when the time comes. Here's a good starter article: Basic Git With Examples.
Related
Has anyone experienced how to add an existing NodeJS API to an existing (Angular) Nx Monrepo?
Unfortunately the manual doesn´t help me so much
https://nx.dev/migration/manual
The process of migrating a repo into your mono repo requires a few manual steps. I think there would not be a simpler way to do it.
Assuming your node project does not share files with your current monorepo, this should be the steps:
on your node repo, create a branch 'to-monorepo' and in it, move all the files to folders that match the nx folder structure and push the commits to it.
remove your package.json file (we will later merge it with the monorepo's one)
once the folders match the nx folder structure, time to merge into the monorepo. From the monorepo add the remote of the other repo
git remote add node-repo <your git repo's node url>
at the monorepo folder, checkout your master
run a pull to make the node repo branches be available in the monorepo
git pull
create a new branch 'merging-node-repo' on your monorepo.
merge the branch node-repo/to-monorepo into your merging-node-repo branch, preserving the history:
git merge node-repo/to-monorepo --allow-unrelated-histories
push your new branch (all the code and its history will now be listed in this new branch)
remove the remote node-repo from your local monorepo configs
git remote rm node-repo
manually merge all the node repo's original package.json file dependencies into the monorepo's one, and run npm install from the monorepo. This way your package-lock.json file is updated. Once you are done, create a commit and push it.
this last step is more tricky. You have now to manually update the monorepo's config files to allow nx to start managing it. This is where the link you had in your question might help. Once you are done, create a commit and push it.
With these steps you can then merge your merging-node-repo branch into master.
I recommend you to create a separated nx workspace with a nodejs project on it. This helps you with having a baseline for all the necessary nx configurations and dependencies.
You might want to make sure your project works via nx commands from this separated workspace; this way you will have a better chance of getting configurations of your monorepo right.
Hopefully this gets you started.
Here is a solution that I wrote and used to import multiple repos into a single monorepo, under whatever subdirectories are wanted, while maintaining commit history:
https://github.com/marcuswestin/monorepo-merge
I've also found two other scripts that look like they might work, but I haven't tried them:
http://choly.ca/post/git-merge-to-monorepo/
https://github.com/ksindi/monoreaper
So I a deployed a Node.js website to Heroku earlier (through Github) and today I made a few changes. I did the same git add . git commit -m 'changes' git push commands but the website on Heroku hasn't changed. Automatic deploys are ON. The code on my Github changed and is correct.
I also used git push heroku master and heroku config:set NODE_MODULES_CACHE=false , it doesn't update the code. Website still the same, like at first deploy.
Also did purge cache.
heroku releases checks out. And I checked the file with heroku bash on the Heroku servers, the file is also updated there. Still, I can't see the changes on the website. Tried different browsers, phones, incognito... And I only use master branch.
FIXED IT:
npm run build in the client folder. Even though I did it already before my first deploy, have to do it again after the changes. Then you can push, commit, deploy, whatever...
Currently whenever I make a change to some code I do the following in terminal:
git init
git add .
git commit -m "Some changes"
git push heroku master
I am not 100% certain, but this seems like it is redeploying the entire project and installing all packages again. If this is the case is there a way to only push the changes made?
For example, if I change one line of code, I just want to push that one file with the change, not the entire project again.
It depends how you're packaging the app, e.g. with webpack.config. Typically you'd package and deploy the entire project to the server each time. This is the correct way to do it (rather than just trying to replace one file), so that you can do project-wide actions like minifying code, processing your CSS, etc. The server would not download/install external packages that are already there unless you specify a different version in your package.json file.
git init only be oncethen every time you make a change just run
git add. (add all changes)
git commit -m "commit"
git push origin master
It's because react has to do some of its magic before Heroku can deploy it properly. That magic includes installing the node modules, compiling all the source files, and then optimizing everything before outputting the build folder with everything in it. There's not a 1:1 relationship between the one line in one file you changed and the build output - react requires a re-build.
I run:
heroku create
and
git push heroku master
Everything Ok, but when I try to view logs, heroku show:
npm ERR! missing script: start
But, in package.json. I have defined script start.
I tried clone source code on heroku/master, It's not my code, it contains only .gitignore, package.json, README.md ....
I try push code to heroku again, it always show everything up-to-date
If it's not your code, you need to ensure if you are looking at correct heroku repo. If it is earlier version of your code, see if git push is actually working without errors and pushing to correct repo and branch being used in heroku. Your code should be pushed to master branch (by default) on Heroku.
I installed GithubHQ in one server and GitlabCI in another server. But now I need do integration between GitlabHQ and GitlabCI. When I go to add a new project in GitlabCI he requests a path .git project, but the project is on another server where the GitlabHQ.
I tried use the path remote, like: http://[domain-name]/[user]/[project].git but he not accept.
I researched about how GitlabCI search the path and found that it does not support remote paths. He use "Rugged::Repository.new(path)" just to get the project on the server.
Does anyone know a way to use paths .git remotes in GitlabCI?
As illustrated by Issue 36:
Actually the purpose of gitlab-ci implies that you install it on deployment point. You install it where you deploy your project
So you are supposed to use a local non-bare repo.
You could, in your case, clone your remote repo on the gitlab-ci server, and use that local path.
In order to build an integration between gitlab and gitlab-ci:
add gitlab_ci user to git group for read access
clone your project via git clone /home/git/repositories to somewhere like /home/gitlab_ci/projects/...
add this project to ci.
setup gitlabhq to use ci service
Thats all.
On gitlab push it will trigger gitlab ci to make git fetch origin, so testing repo will be always up to date.