I'm looking for a CLI command to automate the creation of multiple websites:
It looks like there is CLI hosting support but this is limited to "preview channels":
hosting:channel:create [options] [channelId] create a Firebase Hosting channel
hosting:channel:delete [options] <channelId> delete a Firebase Hosting channel
hosting:channel:deploy [options] [channelId] deploy to a specific Firebase Hosting channel
hosting:channel:list [options] list all Firebase Hosting channels for your project
hosting:channel:open [options] [channelId] opens the URL for a Firebase Hosting channel
hosting:clone <source> <targetChannel> clone a version from one site to another
hosting:disable [options] stop serving web traffic to your Firebase Hosting site
https://github.com/firebase/firebase-tools/tree/master/src/commands
I also couldn't find a relevant hosting command in the source code of Firebase tools. Any ideas?
From the documentation on adding additional sites it seems that adding sites right now is only supported through the Firebase console.
I'd recommend filing a feature request on the Github repo.
Related
i Already hosted a Web page Project to Filebase console using firebase deploy comment , How can i Download the Project files Now ?
firebase deploy
You can not download the project files...
That you can download is the data/files you have stored in your realtime database or firestore database.
You can switch between deploys as well, you can roll back to older deploy or to the newer depending of your needs, but you can not download any of it.
There is no blanket "code pull" from Firebase, so you will need to take a different approach for each product.
Product
How to get the code/data
Hosting
There is no API to get your hosted files back from Firebase, but you can usually get pretty close by crawling the site. See Pull lost code from Firebase Hosting deployment
Realtime Database
You can either use one of the SDKs, use the REST API (for small databases this may be as simple as adding .json to the end of the database URL), or you can set up automatic backups and get the data from there.
Firestore
You can either use one of the SDKs or REST API here too, or you get export through the console or gcloud CLI as explained here
Authentication
You can export all your users through the Admin SDK or the Firebase CLI
Cloud Functions
The closest you can get here is to copy/paste the code from the Google Cloud console as explained here: Get code from firebase console which I deployed earlier
For logging purposes I´d like to print to console or even display the current deploy ID (or message) of my firebase web app that is being accessed by the browser.
Firebase Hosting recently released a new REST API. You can use sites.releases.list to see what version is currently deployed.
Old answer:
Firebase deploy IDs don't appear to be available anywhere via programmatic access. The CLI doesn't support listing current or previous deploys.
My recommendation would be to go in the other direction. Have your source code in a vcs like git. When you build and deploy a new version set the vcs hash or version in the deployed code and as the message for firebase deploy. You can then log the log the source version in your code and you can manually associate that back to a release in the Firebase UI.
I have a problem with a web hosting project. I created a new proyect in google firebase, and I executed the following commands:
C:\myproject>firebase init functions
C:\myproject>firebase deploy --only functions
But the site says this:
Site Not Found
Why am I seeing this?
There are a few potential reasons:
You haven't deployed an app yet.
You may have deployed an empty directory.
This is a custom domain, but we haven't finished setting it up yet.
How can I deploy my first app?
Refer to our hosting documentation to get started.
What could I do for show, at least, some text when an user go to my project url?
The way you now invoke the Firebase CLI, it will only deploy the Cloud Functions in your project. It will not deploy the web site. In fact, the way you've run it, it probably didn't even create a web site to deploy.
Initialize the project with:
firebase init
And answer the questions this shows.
If you want to deploy the web site, use:
firebase deploy --only hosting
More likely you should simply deploy everything to prevent running into this problem:
firebase deploy
I want to try the demo for polymerfire in firebase. To get it run locally I followed these steps. But what exact steps do I need to do to get it to run in firebase?
I figured firebase init and firebase deploy should be run but the browser only displays errors in the console. Must the polymer project be build in a certain way and what should the firebase "public" folder be?
All files from public folder will be deployed to your Firebase static web hosting, so you can access them though your Firebase hosting address like https://projectname-5gek53.firebaseapp.com/. This allows you to upload your web app.
You build your polymer app (I guess you need to run polymer build). You drag all files generated as production build to your public folder. Next, you run firebase deploy and after deployment process your app will be accessible from your hosting address as I mentioned above.
Edit: Polymerfire demo is actually not that simple to export, but I found a really nice tutorial step-by-step from Google Codelabs here is a link Build a Progressive Web App with Firebase, Polymerfire and Polymer Components
I just installed a new version of the polymer cli and Firebase cli. When I do a Polymer build, no build/bundled or build/unbundled is created.
I do get a build/default, which I can run with a firebase serve and a firebase deploy. So something has changed recently. just fyi
I only ask because I'm using a shared hosting environment at the moment and they don't support Node.js.
The only documented way to deploy content to Firebase Hosting is to use the Firebase command line interface.