DEV Community

Matt Dyor
Matt Dyor

Posted on

Pushing an Existing Node App to Azure

If you have code that is working on your local machine, and you want to deploy it to Azure, and you have a DevOps account configured, here is how.

  • If you were previously deploying somewhere else (like Heroku), delete the .git directory (there is probably a more elegant way to reset git, but delete works)
  • Configure git in the directory
git init
git add .
git commit -m "initial commit"
Enter fullscreen mode Exit fullscreen mode
  • In Azure DevOps, create a new project
  • Navigate to Repos. You will see an option to push an existing repository from command line. Grab that code
git remote add origin
git push -u origin --all
Enter fullscreen mode Exit fullscreen mode
  • in the Azure Portal, you want to create a "Web App + PostgreSQL" instead of creating the web app and database separately, and having to stitch the networking and permissions and port configurations together. This is goofily hard to find, so try
  • I tried using pipelines, but that was not successful, so I just used the VS Code Azure Extension to deploy directly (explained here)
  • Visit the Overview tab in the Azure portal, click on the URL, and your app should be alive.
  • If you use Sequelize, adjust your local database settings to point to the Azur PostgreSQL server, and run:
sequelize db:migrate
Enter fullscreen mode Exit fullscreen mode

Next steps:

  • Figure out how to fire off sequelize from Azure (instead of having to update from the local application)
  • Figure out how to use Azure Pipelines. I was able to get the Azure Pipelines set up to run upon code upload, but something was not working. If anybody has a blog post talking about configuring Azure pipelines for node (that is current), please share it.



Top comments (0)