Steps to deploy React app on Netlify and push later changes
Note: This post is a details-post for the post: Learning web app development through free online tutorials – Organized Notes and Log, https://raviswdev.blogspot.com/2024/03/learning-web-app-development-through.html .
Given below are the steps to deploy a React app on Netlify:
- In VSCode terminal run:
- git init
- git add .
- git commit -m “first commit”
- Create public repository on github and then use commands listed on github under “…or push an existing repository from the command line” and execute them in VSCode terminal.
-
In app.netlify.com,
- Choose 'Add new site' -> 'Import an existing project'
- Then choose Deploy with Github. This should lead to an 'Authorized' message window which disappears on its own later. But sometimes the 'Authorized' window does not appear, at which time one has to retry.
- A list of github projects is shown. Choose the github repo created earlier.
- In deploy window that is shown, optionally specify sitename and then optionally specify environment variables. Do not quote the value of environment variables.
- Click the Deploy button. This will show a deploy in progress window. Sometimes deployment is quick (few minutes) and sometimes it is slow (tens of minutes).
- Once deploy is done, the link for the deployed app. is shown.
- Setting env. variable example: Use https://crazy-sheath-dress-crab.cyclic.app/api/posts as the value and not 'https://crazy-sheath-dress-crab.cyclic.app/api/posts' as the value of REACT_APP_API_URL env. variable.
- To change env. variable value: (For the specific site) Site configuration (in left pane) -> Environment variables (in right pane) will list the environment variables. Clicking on a particular env. var shows its values for various deploy contexts. The Options drop-down at far-right has an Edit option to change the value(s).
- To restart the app to use changed env. vars, click on Deploys in left pane (of main Site page/window). On the far right, towards middle of the page, the 'Trigger deploy' dropdown is shown. Choose Deploy Site from this drop-down to redeploy the app.
- Deploy sometimes does not provide a proper update in the deploy in progress window. So one has to either refresh the window or try out some other deployment related links.
- Deployment log details can be seen by clicking buttons in lower part of page having the deploy in progress message.
- About time taken for deploy: [Support Guide] How long should Netlify builds take?, https://answers.netlify.com/t/support-guide-how-long-should-netlify-builds-take/151
- Site Overview shows the link of deployed app.
- In VSCode terminal run:
- git add . [It adds only the changed files to staging area.]
- git commit -m "[suitable message]"
- git push
- The changes will get pushed to Github repo.
- Within minutes of Github repo update, Netlify will pick up the changes and start redeploy of the app.
How do i suspend the hosting of the website?, https://answers.netlify.com/t/how-do-i-suspend-the-hosting-of-the-website/16135 redirects to: [Support Guide] What’s the easiest way to create a temporary “maintenance page” for my site?, https://answers.netlify.com/t/support-guide-what-s-the-easiest-way-to-create-a-temporary-maintenance-page-for-my-site/338
Limiting bandwidth/traffic to netlify on starter tier plan, https://answers.netlify.com/t/limiting-bandwidth-traffic-to-netlify-on-starter-tier-plan/18163/7
Comments
Post a Comment