I'm trying to create two applications(NodeJS backend and ReactJS Frontend) using a VPS server with Dokku (mini Heroku) configured.
Basically, that's what i did so far:
Created a folder for the project on my VPS server for my project
Entered inside the folder previously created
Executed the following command:
git clone:<project_url_backend>
Then I entered the backend's folder created by the git clone command and then executed:
dokku apps:create backend-proj
git remote add dokku dokku#<my_ip>:backend-proj
git push dokku master
Everything looks fine until here and when I open the link that dokku created for the backend, it opens fine and I can use the backend correctly.
So I repeated the process for the frontend.
Inside the project's folder, i run:
git clone:<project_url_frontend>
I entered on the subfolder created by git and then run:
dokku apps:create frontend-proj
git remote add dokku dokku#<my_ip>:frontend-proj
git push dokku master
It builds fine, but when I open the created link for the frontend project, it opens the backend, not the frontend.
Ps: I had issues with the react project(frontend), so I had to fix the Procfile, and run the frontend project by a server.js with express.js, serving the react application. I don't know whether this might have some influence on the process but I had to say anyway
The problem was that I needed to put express.js as one of the required dependencies inside the package.json file. Then I recreated the application on Dokku and then it worked fine
Related
I push updates to Heroku
git push Heruko master
then go and run my app from the Heroku page and the changes are not showing in the running app.
If I run bash and look at the files on Heroku, the changes are in the files.
It shows "Everything is up-to-date" message and no code reflects.
I've tried restarting the app and the changes are still not reflected in the running app.
don't forget to build your front and copy that folder to the public folder on the backend... it's happen to me ;)
check the git log to check the date and the name of the commit you are uploading.
if the commit is right, try deleting the existing app on heroku and upload again
Check in your package.json, the start script is pointing to your server.js file
I am writing a number of VueJS apps that take part in a larger Microservices environment. My current workflow seems long winded but I can't find anything better and would like advice on how I could do it better. Here is my current work flow.
Write VueJS development version (testapp)
Push testapp to git server
npm rum build to get a dist folder
Create a nodejs/express app (testapp_server)
Copy testapp dist folder to the testapp_server html folder
Push testapp_server to git server
On production server clone testapp_server from git
pm2 start app.js --name testapp_server
If I make changes to my VueJS test app in dev, I have to go through this whole process again to get it into production.
I am on a closed secure network, so I don't have the luxury of using Heroku etc.
Is there a better way?
Update: I have just found out about git sparse-checkout which allows the checking out of specific folders from a repo. I am thinking I could include my dist folder in my development git repo and then just check out the dist folder using sparse-checkout directly into a node/express app on my production server.
I have a node.js app in a git repo that looks like this:
/docs
/server
.gitignore
The actual node app is in the 'server' folder, but both it and the docs are in the git repo seen above.
I went through heroku's instructions for creating an app, and have the heroku cli installed on my laptop.
I went into the server folder of my repo and ran heroku create and made sure there was a new remote for heroku afterward-- there was. I also made sure to run heroku buildpacks:set heroku/nodejs and it did so successfully. (I can see that in my heroku dashboard.)
But when I try git push heroku master I get the error in my post title.
Just for fun, I deleted my app on heroku and this time ran heroku create from the root folder, and not the server one. I also ran heroku buildpacks:set heroku/nodejs again. I double-checked the new heroku app name and remote and tried to push again. Unfortunately I got the same "App not compatible with buildpack" message.
Is all this because my git repo's root folder doesn't have a package.json file? Is there a way I can tell heroku, 'hey, look in the server folder for package.json when you're building'?
I am new to heroku and I am trying to create an app and deploy, but when i do heroku create on CLI this creates a random name for the application. So I used heroku app:create project-name which created the application with the project-name but how do i deploy my existing code to that application.
If you've already performed heroku create without specifying a name in your application folder then you will already have a git remote named heroku. You can confirm this by doing
git remote -v
in your project folder which will probably show something like
heroku git#heroku.com:stark-taiga-7738.git (fetch)
heroku git#heroku.com:stark-taiga-7738.git (push)
When you then create an application specifying an application name then the existing remote will not get updated with the new application details.
To fix this you will need to remove the existing git remote named heroku and then add a new one pointed to the correct application.
git remote rm heroku will remove the existing remote
heroku git:remote --app <new app name> will create a new heroku remote pointing at your new application will then let you do git push heroku master and deploy to the correct application.
Heroku uses Git to deploy. Navigate to the home directory of your application and simply do
git push heroku master
See the documentation for deploying a node.js application to Heroku for details.
Hi I developed a small application in nodeJs and angular using the angular-fullstack generator for grunt, following the instruction on: https://npmjs.org/package/generator-angular-fullstack, when I finished the developement run:
3) yo angular-fullstack:deploy heroku
4) cd heroku && git push heroku master
my application now is on heroku and the dynos starts, but when I visit the domain where heroku put my application: http://dollsdresses-gnosis.herokuapp.com/
I can see that some files are missing: main.css, script.js , all I can see is a white page with my favicon, when I use my application on my computer, running: grunt server, it works, so I think there is something that I do not know or do wrong on deploying on heroku.
You may not have added main.css, script.js et al to git, so they are not pushed to Heroku when you run git push heroku master. Make sure to git add them.