Learn how to expose your website either static/frontend/fullstack to the cloud
DevOps: A collection of techniques trying to bridge the gap between development and operations. Pipeline: A series of automated steps that to simplify the testing, building, and deployment of code. CI/CD: Continuous Integration / Continuous Delivery (sometimes Deployments). Subparts of a pipeline dedicated to integrating code, delivering it, and deploying it. Cloud Provider: Companies that offer rentable servers and hosting services that provide flexible computing.
- GitHub Pages [Frontend]
- Firebase Hosting [Frontend]
- netlify [Frontend]
- Vercel [Fullstack/Frontend]
How to use it ?
- Install gh-pages locally
npm install gh-pages --save-dev
- Add new script to
package.json
file to deploy your website
"scripts": {
// replace dist with your build dir folder
"deploy": "gh-pages -d [dist]"
}
- Add "homepage” key at the top level in
package.json
file.
/*
* Replace <username> and <RepositoryName> with your username
* from GitHub and the name of your new repository.
*/
"homepage": "https://<username>.github.io/<RepositoryName>/",
- Deploy your website to Github Pages by running this command
npm run deploy
Note
gh-pages
behind the scenes will create another branch calledgh-pages
to push your build files into it
-
You need to create new project first on firebase console
-
Install
firebase-tools
package
$ npm install -g firebase-tools
-
Login to the account
firebase login
-
Init firebase configuration for hosting
firebase init
-
When your website ready just type
firebase deploy
How to use it ?
- Create new account on netlify
- Install netlify-cli globally
npm install netlify-cli -g
- login to your account from
netlify-cli
using this commandnetlify login
- Inside your project folder genrate new website id for dpploy using this command
netlify init
- To deploy and make your website live use this command
netlify deploy --dir=dist --prod
Notes:
The deploy
command needs to know which folder to publish.
Netlify CLI will look for this information in three places, in
the following order:
- in flags specified in the command itself
--dir=dist
. - in a netlify.toml file stored at the root of your project directory.
- in your site settings in the Netlify UI.
# If you want to run your project on your local machine
$ netlify dev
# If you want to share it with your team
$ netlify dev --live
In case you want to expose your local server without worrying about deploy it on acutely server.