I have a nodeJS app with PostgreSQL database.
I've modified source code, and now, to deploy it i'll need to deploy source code to server from git repo. Changes will be applied, server will be restarted and that's all.
Is there similar approach for deploying Postgres changes? Or i'll always need to manually write bunch of queries, which will modify database schema?
Related
Possibly newbie question.
I made an app (Postgres, Node, React) and I want to send it to somebody who can try it out with this little db that I made for it. Is there a way to do that? Googling has brought up a few seemingly positive results but none of them I've been able to apply to my application. Is there a resource I can look into (OS, VS environment)?
Like crimson589's comment you can create a db dump with all the sql used to create the database
pg_dump dbname > outfile
https://www.postgresql.org/docs/9.1/backup-dump.html
commit outfile to git or other version control
If you want to use github, create a repo via the web and it tells you how to add your code to the repo.
Problem: I have a project with a server (Express Server that handles file uploading and deleting) and client (Front End Create-React-App). The project structure looks like follows:
Root Folder With Server
Client Folder
Each folder has it's own package.json. Server Package.json. Client package.json
I'm trying to build and deploy onto azure however the pipeline hangs on "npm install and build".
It seems like the build succeeds but this phase just hangs. Here is my server.js (the routes are not included) file and yaml file just in case.
I'd appreciate any kind of help. Thank you!
Troubleshooting suggestions:
In the case of ensuring that the code in github is consistent with the local code, if an exception occurs, it is recommended to replace the linux platform and redeploy.
It is recommended to use my suggestion to recreate the repository, and then check the Action status in github.
Sum up:
In general, it is more appropriate to use Linux in azure than windows. For example, Linux supports npx, and may also support other packages and commands.
When the local code can run normally, there is generally no problem when deploying to github, unless there may be modifications, which we have ignored. So make sure the code is consistent.
General correct deployment steps:
First in the portal, make sure to create a web app application (not a static web app), and select the node environment.
Make sure that the sever program can run normally locally. Create a new repository in github.
->git init
->git add.
->git commit -m'init'
->git remote add origin https://github.com/{your name}/newAppname.git
->git push -u origin master
Connect in the Portal's Deployment center.
Then check the status of Action in github.
I am struggling with a problem connected with the migrations in knex on the production environment (heroku). I have made some changes and created 8 new migrations to update the model. After creating new migrations I have reached 47 migration files. After uploading the changes to the Heroku I executed as usual knex migrate:latest and there was no effect. I have received the message Already up to date.
I have decided to take a look at the knex_migrations table to see if maybe something is wrong there. The result that I can see that the new migrations were not written into that database (please see the picture for reference.
When we take a look at the migrations it looks like this:
Clearly we can see that knex was able to run "20200216191040_receiver_company.js" as last one.
When I take a look at the knex_migrations_lock table the only entry that is existing over there looks like this:
Does anyone know how to force knex to run the migrations? The version of knex that I use it 0.16.3.
EDIT:
I want to add that on the local machine I have no problems with running the migrations. Additionally, I have checked if the migration files are present on the server and after pulling the current state our of the Heroku I can see all of the migration files that were not executed.
If the change of the migration is not implemented in the database, you can try to manually remove the record of the migration from the knex_migrations or you migrations table,
and try to re-apply the knex migrate:latest command.
but before you try this way, make sure to keep a backup, or run it on your local machine or development server first.
So basically, I have Node.js application locally (WebStorm project) and constantly pushing changes to git. I would like to create one-click desployment solution executable from my WebStorm project what will:
Clone/Pull project from git
Install dependencies
Edit config (database connection, etc...)
Based on config make sure database is ready and if not initialize new one
I achieved parts 1 and 2 by using pm2 deployment function. If I run command, everything is updated from git and dependencies are installed.
Part 3 is problem, because I do not want to push production config into git (even it is private repo) and I have only example config in git repo. I was thinking about script what will copy example config and then prompt me somehow to edit it, but I am not sure now to achieve this without connecting manually into production server and second problem is I need to copy new example config every new version, because there might be changes in config structure between versions.
Any suggestions how to achieve this easily and without need to log into production server manually?
Part 4 is nice to have feature if anyone have suggestions how to achieve this, too.
I have managed to use Parse Server on Heroku for quite sometime now using this guide.
https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku
however I would like to use the dashboard but my parse server is 1.6, is there a way to update my parse server from heroku?
I assume you deployed parse-server to Heroku simply by using the Deploy button on the Heroku website. If so you can manually fetch the changes of parse-server-example from the original repository onto you computer and push them back to heroku.
Clone the current deployment of parse-server from Heroku to your computer
Add the original parse-server-example as a remote repository from https://github.com/ParsePlatform/parse-server-example.git
Fetch the changes from the remote repository that you've added
Merge
Push to heroku
Note:
Parse Server is currently at 2.2.9. If you have a live app it would be recommendable to test if your app still works after the update in a test environment prior to the production environment .