github.com/lyeb/hugo@v0.47.1/docs/content/en/hosting-and-deployment/hosting-on-firebase.md (about)

     1  ---
     2  title: Host on Firebase
     3  linktitle: Host on Firebase
     4  description: You can use Firebase's free tier to host your static website; this also gives you access to Firebase's NOSQL API.
     5  date: 2017-03-12
     6  publishdate: 2017-03-12
     7  lastmod: 2017-03-15
     8  categories: [hosting and deployment]
     9  keywords: [hosting,firebase]
    10  authors: [Michel Racic]
    11  menu:
    12    docs:
    13      parent: "hosting-and-deployment"
    14      weight: 20
    15  weight: 20
    16  sections_weight: 20
    17  draft: false
    18  toc: true
    19  aliases: []
    20  ---
    21  
    22  ## Assumptions
    23  
    24  1. You have an account with [Firebase][signup]. (If you don't, you can sign up for free using your Google account.)
    25  2. You have completed the [Quick Start][] or have a completed Hugo website ready for deployment.
    26  
    27  ## Initial setup
    28  
    29  Go to the [Firebase console][console] and create a new project (unless you already have a project). You will need to globally install `firebase-tools` (node.js):
    30  
    31  
    32  ```
    33  npm install -g firebase-tools
    34  ```
    35  
    36  Log in to Firebase (setup on your local machine) using `firebase login`, which opens a browser where you can select your account. Use `firebase logout` in case you are already logged in but to the wrong account.
    37  
    38  
    39  ```
    40  firebase login
    41  ```
    42  In the root of your Hugo project, initialize the Firebase project with the `firebase init` command:
    43  
    44  ```
    45  firebase init
    46  ```
    47  From here:
    48  
    49  1. Choose Hosting in the feature question
    50  2. Choose the project you just set up
    51  3. Accept the default for your database rules file
    52  4. Accept the default for the publish directory, which is `public`
    53  5. Choose "No" in the question if you are deploying a single-page app
    54  
    55  ## Deploy
    56  
    57  To deploy your Hugo site, execute the `firebase deploy` command, and your site will be up in no time:
    58  
    59  ```
    60  hugo && firebase deploy
    61  ```
    62  
    63  ## CI Setup
    64  
    65  You can generate a deploy token using
    66  
    67  
    68  ```
    69  firebase login:ci
    70  ```
    71  
    72  You can also set up your CI (e.g., with [Wercker][]) and add the token to a private variable like `$FIREBASE_DEPLOY_TOKEN`.
    73  
    74  {{% note %}}
    75  This is a private secret and it should not appear in a public repository. Make sure you understand your chosen CI and that it's not visible to others.
    76  {{% /note %}}
    77  
    78  You can then add a step in your build to do the deployment using the token:
    79  
    80  ```
    81  firebase deploy --token $FIREBASE_DEPLOY_TOKEN
    82  ```
    83  
    84  ## Reference links
    85  
    86  * [Firebase CLI Reference](https://firebase.google.com/docs/cli/#administrative_commands)
    87  
    88  [console]: https://console.firebase.google.com
    89  [Quick Start]: /getting-started/quick-start/
    90  [signup]: https://console.firebase.google.com/
    91  [Wercker]: /hosting-and-deployment/deployment-with-wercker/