这是一个由 2 部分组成的答案,第 1 部分概述了 Github 说明并在第 19 步结束。第 2 部分扩展了第 1 部分中无法容纳的更多信息,它将详细地从第 19 步开始。我必须将其添加到另一个问题并将其链接到此问题。
这里有Github
按顺序列出的步骤。仅供参考,我将原来的步骤与原来的步骤保持一致Github author
列出了它们,但在下面我放置了一堆子步骤,每个步骤下都有详细的解释和说明。
假设您已经创建了一个Firebase
项目并得到了你的GoogleService-Info.plist
file
打开你的GoogleService-Info.plist
文件。下列variables
来自Github directions
与相关GoogleService-Info.plist keys
-FB_NAME is the same thing as your PROJECT_ID
-FB_URL is the same thing as your DATABASE_URL
-FB_TOKEN is the same thing as your API_KEY
So
-if your PROJECT_ID is "sneakersearch-az12" then your FB_NAME is "sneakersearch-az12"
-if your DATABASE_URL is "https://sneakersearch-az12.firebaseio.com" then your FB_URL is "https://sneakersearch-az12.firebaseio.com"
-if your API_KEY is "0012abc789xyz00019" then your FB_TOKEN is "0012abc789xyz00019"
//These are not inside your GoogleService-Info.plist but you will encounter them later
-FB_SERVICEACCOUNT pertains to downloading a json file from the your project's Firebase console. You will need to go to the page SERVICE ACCOUNTS it's exp in step 3B
-clientEmail is the same thing as your Firebase Service Account. You get this from either the Unknown file or on your SERVICE ACCOUNTS page via the FB Console and it's exp in step 3D and 3B
-privateKey is the same thing as private_key but this key is NOT your API_KEY, it is a key that is inside the Unknown file from the SERVICE ACCOUNTS page. It looks something like: "-----BEGIN PRIVATE KEY-----\nCYchgacopuyvpc017246t124087t6hpUTYVPUSVDPUCHVEpcl889ljbsiugr4ygrphvuygpuy...mutli-lines...\n-----END PRIVATE KEY-----\n". Also exp in step 3B
每一个下面Github
步骤我有意见,然后是指示。在我使用以下值的说明中,您应该使用您的project's values
。因此,对于步骤示例,我将使用这些keys
and values
:
//GoogleService-Info.plist
PROJECT_ID---aka--FB_NAME: sneakersearch-az12
DATABASE_URL-aka--FB_URL: https://sneakersearch-az12.firebaseio.com
API_KEY------aka--FB_TOKEN: 0012abc789xyz00019
//FB Service Account info
Firebase service account--aka--clientEmail: [email protected] //this is auto generated for you once you've created your firebase project
//Heroku and Bonsai info
Heroku Instance Name--aka--Heroku App Name: sneakersearchinstanceAtoZ
BONASI_URL --aka--Bonsai Cluster URL: https://abc123a01:[email protected]
Swift 数据模型:(这将与您在步骤 19 中放入映射对象中的内容匹配)
class Sneakers: NSObject{
var sneakercondition: String?
var sneakername: String?
}
VC 与文件路径,我将数据发送到 Firebase 和搜索SnkPath是一个单独的文件路径,Bonsai 将在其中运行搜索:
@IBOutlet weak var conditionTextField: UITextField!
@IBOutlet weak var nameTextField: UITextField!
var dbRef: FIRDatabaseReference!
let userID = FIRAuth.auth()?.currentUser?.uid
override func viewDidLoad() {
super.viewDidLoad()
self.dbRef = FIRDatabase.database().reference()
}
@IBAction func postDataButton(){
var dict = [String:AnyObject]()
dict.updateValue(conditionTextField.text!, forKey: "sneakercondition")
dict.updateValue(nameTextField.text!, forKey: "sneakername")
let idPath = self.dbRef.child("users").child(userID!).child("sneakersPath").childByAutoId()
//searches will run on this file path
let searchSnkPath = self.dbRef.child("searchSnkPath").childByAutoId()
idPath.updateChildValues(dict){
(err, ref) in
searchSnkPath.updateChildValues(dict)
}
}
}
Inside FBDatabase
我要搜索的数据的存储路径root/searchSnkPath/autoID
它有 2keys
named sneakercondition
and sneakername
代表数据。我想要从中提取搜索结果的路径是root/searchSnkPath
root
|
@-users
| |
| @-userID
| |
| @-sneakersPath
| |
| @-autoID
| |-sneakercondition
| |-sneakername
@searchSnkPath
|
@-autoID
|-sneakercondition
|-sneakername
如果我想在searchSnkPath
并查询这 2 个keys
然后在里面config.js
我找到的文件exports.paths
在里面我可以设置要搜索的信息
exports.paths = [
{
path : "https://sneakersearch-az12.firebaseio.com/searchSnkPath", //exp in Step 4
index: "firebase", //exp in Step 17
type : "sneakers", //exp in Step 19
fields: ['sneakercondition', 'sneakername'] //these are the specific keys to search on (exp in Step 4)
}
]
第 4 步涵盖了所有这些
重要的跑完之后git clone https://github.com/firebase/flashlight
(步骤 2A)您需要cd
进入flashlight
文件夹(步骤 2B),因为从该点开始的所有步骤都发生在flashlight
文件夹和NOT您的主 Xcode 项目的文件夹。Xcode 项目的文件夹中没有任何内容无法运行,因为它没有 package.json 文件
第 1 部分 - Github 步骤:
1•安装并运行ElasticSearch或通过Heroku添加Bonsai服务
1.评论:
-Bonsai
将在第 10 步添加
- 在继续之前,您需要按顺序执行以下步骤 1A-1E
1.路线:
1A.下载并安装Node.js
from https://nodejs.org/en/download/
1B.下载并安装Heroku Toolbelt
(已更名为Heroku CLI
) at https://devcenter.heroku.com/articles/heroku-cli。仅供参考,我使用的是 OS X Installer,而不是 OS X Homebrew。
1C.下载并安装后Heroku Toolbelt/CLI
登录 Heroku.com 并创建一个帐户
1D.创建后Heroku
无需创建新帐户Heroku App
您将在步骤 9 中使用命令行执行此操作。这很容易
1E.打开终端并运行:node -v
找出当前的node version
你的跑步(例如你得到v6.9.1
)。在步骤 2D 中,您必须确保那里的版本与此输出匹配。
2·git克隆https://github.com/firebase/flashlight
2.评论:
-假设 Xcode 项目位于桌面上名为的文件夹内sneakerSearchFolder
- 在航站楼内您cd
到sneakerSearchFolder文件夹 - 即运行:cd Desktop/sneakerSearchFolder
-进入sneakerSearchFolder后,您clone
the github repo
at https://github.com/firebase/flashlight
-重要的然后是你cd
to flashlight
文件夹,即运行:cd flashlight
-您将需要node version
你的跑步根据https://devcenter.heroku.com/articles/deploying-nodejs
-run: node -v
得到什么node version
正在运行在flashlight
文件夹(即v6.9.1
)稍后当你制作一个Heroku instance
您将需要根据devcenter.heroku
上面的链接
-现在你的里面flashlight
文件夹,如果node version
您刚刚运行的版本与步骤 1E 中的版本不匹配,您需要更新手电筒文件夹内的版本以使它们匹配。将 Node.js 升级到最新版本 如果两个版本都匹配那么你不必担心这个
-假设您的节点版本匹配,打开package.json
文件内的flashlight
文件夹并添加一个"engines"
键值为的对象node version
您目前正在使用
"engines": {
"node": "node_version_num_you_got_back_from_running_node -v"
}
2.路线:
2A.在终端中导航到您的 Xcode 项目所在的任何文件夹
2B. run: git clone https://github.com/firebase/flashlight
2C. run: cd flashlight
2D. run: node -v
2E.打开flashlight
文件夹然后打开package.json
。将以下内容添加到文件中。
"engines": {
"node": "whatever_was_returned_from_Step_2D"
}
2E-示例。仅供参考,这是一个例子。打开package.json
并在之后"dependencies"
closing brace
,将其添加到那里。请务必在右大括号后添加逗号。并且不要在版本号前添加“v”。保存文件。
"dependencies": {
"JQDeferred": "~1.9.1",
"colors": "~0.6.2",
"elasticsearch": "^11.0.1",
"firebase": "^3.5.2"
},
"engines": {
"node": "6.9.1"
}
3•npm安装
从现在开始,你的内心非常重要flashlight
文件夹而不是主项目的文件夹,以便一切正常工作,否则您会收到错误
3.评论:
-你应该还在你的里面flashlight
folder
-登录到Firebase
,在 FB 项目的控制台中,转到Project's Settings
(旁边的小圆形图标Overview
),在项目设置中选择SERVICE ACCOUNTS
,转到该部分Firebase Admin SDK
。您必须在这里做两件事。 1. 找到并复制您的Firebase service account
, 看起来像[电子邮件受保护]2. 在页面底部,您必须单击Generate New Private Key
按钮,它将下载一个Unknown file
您需要将其重命名为service-account.json
。如果它给文件命名除了Unknown
只需将其重命名为service-account.json
。重命名文件后将其拖到您的flashlight
文件夹,因为步骤 4BFB_SERVICEACCOUNT
将需要从那里访问该文件。确保将文件放入FLASHLIGHT FOLDER
!
-这没有在 github 步骤中列出,但它是必要的。您必须添加Firebase Server SDK Credentials
到你的项目
-你需要在你的flashlight
运行 $ 的文件夹npm install firebase-admin --save
命令,否则你会得到错误,因为它会寻找packae.json
文件。该文件已经在您的内部flashlight
文件夹而不是主 Xcode 项目的文件夹内
- 按照以下指示:https://firebase.google.com/docs/server/setup, 在 - 的里面Initialize the SDK
部分。您将需要以下值中的 2 个:Unknown
文件(现在应该重命名为service-account.json
)来初始化它。这些值位于第 5- 行private_key
and 6-clientEmail
。仅供参考clientEmail
and Firebase service account
是同一件事
-这就是你initializing
在 - 的里面SDK
:
var admin = require("firebase-admin"); //this imports the npm firebase-admin module you just installed
admin.initializeApp({
credential: admin.credential.cert({
projectId: "<PROJECT_ID>", //projectId: is the PROJECT_ID from your GoogleService-Info.plist file
clientEmail: "foo@<PROJECT_ID>.iam.gserviceaccount.com", //clientEmail: is on line 6 in the Unknown file which is also your "Firebase service account" info
privateKey: "-----BEGIN PRIVATE KEY-----\n<KEY>\n-----END PRIVATE KEY-----\n" //privateKey: is NOT your API_KEY/FB_TOKEN. Inside the Unknown file on line 5 there is a very long multiline "private_key" key. It looks something like "-----BEGIN PRIVATE KEY-----\nCYchgacopuyvpc017tEpcl889ljbsiugr4ygrphvuygpuy...mutli-lines...\n-----END PRIVATE KEY-----\n". You need to copy and paste it from there to here. Be sure to include the "-----BEGIN PRIVATE KEY-----\n and \n-----END PRIVATE KEY-----\n
}),
databaseURL: "https://<DATABASE_NAME>.firebaseio.com" //databaseURL: is the DATABASE_URL from your GoogleService-Info.plist file
});
- 仅供参考Initialize the SDK
部分您还可以选择使用上面写着的顶部部分path/to/serviceAccountKey.json
您可以改为提供重命名的未知文件的路径。我选择底部inline
部分,因为它更容易。如果您遵循这些步骤,则无需担心这一点。
-在 - 的里面flashlight
文件夹中有一个app.js
文件,复制并粘贴上面的代码并将其放在文件的顶部
-回到终端内,在命令行上运行:npm install
-如果一切顺利,您应该收到的唯一警告是No repository field
and No license field
3.路线:
3A。确保您的内部flashlight
文件夹运行:pwd
3B.登录您的Firebase Console
's SERVICE ACCOUNTS
页面并单击Generate New Private Key
按钮下载Unknown
file.
3C.重命名Unknown
文件至service-account.json
并将文件放入您的flashlight
folder
3D.在 - 的里面service-account.json
文件复制key
named client_email
或者您可以将服务帐户信息复制到您的Firebase SERVICE ACCOUNTS
page
3E.在终端内运行:npm install firebase-admin --save
3F.复制该部分内的内容Initialize the SDK
并使用这些值初始化字段:
var admin = require("firebase-admin");
admin.initializeApp({
credential: admin.credential.cert({
projectId: "sneakersearch-az12", //use your PROJECT_ID
clientEmail: "[email protected]", //clientEmail: is on line 6 in the Unknown file
privateKey: "-----BEGIN PRIVATE KEY-----\nCYchgacopuyvpc017tEpcl889ljbsiugr4ygrphvuygpuy...mutli-lines...\n-----END PRIVATE KEY-----\n" //privateKey: is on line 5 in the Unknown file
}),
databaseURL: "https://sneakersearch-az12.firebaseio.com" //use your DATABASE_URL
});
3G.在 - 的里面flashlight
文件夹,打开app.js
文件,使用正确的值粘贴/保存上面的代码
3H. run: npm install
4•编辑config.js(参见顶部的注释,您必须设置FB_URL和
至少 FB_SERVICEACCOUNT)
4.评论:
-在你的里面flashlight
文件夹中有一个文件名为config.example.js
, 打开它
-在这个里面config.example.js
文件是你找到的地方FB_URL
and FB_SERVICEACCOUNT
变量(它们列在第 13 行和第 23 行)
-你需要改变exports.FB_URL = process.env.FB_URL || 'https://<YOUR APP>.firebaseio.com';
to exports.FB_URL = process.env.FB_URL || 'whatever_your_DATABASE_URL_is';
(请务必将whatever_your_DATABASE_URL_is
在单引号或双引号内)
- 23号线exports.FB_SERVICEACCOUNT = process.env.FB_ACC || 'service-account.json';
是用来访问的service-account.json file
从步骤 3C 开始(无需在此处添加或更改任何内容,因为它将自行访问)
-您现在必须设置数据所在的路径(例如搜索路径用于向上面的 ViewController 内的 FB 发送数据)、索引(第 17 步)以及您想要在第 64,65 和 66 行监控的类型(类似于您的数据模型)
exports.paths = [
{
path : "users",//line 64
index: "firebase",//line 65
type : "user"//line 66
},
-path
是你的地方data
坐在里面FB
。这是您想要从中提取搜索结果的地方,即<DATABASE_URL>/searchSnkPath
-index
第 17 步中的 exp
-type
exp in Step 19
-仅供参考,第 69-79 行将设置您想要监视的另一条路径。如果需要,您可以删除或注释掉它们。您还可以创建更多路径来监视,即如果您有一条路径<DATABASE_URL>/searchClothingPath
那么您也可以对其进行搜索。如果您愿意,您还可以添加更多路径,即:
exports.paths = [
{
path : "https://sneakersearch-az12.firebaseio.com/searchSnkPath"
index: "firebase",
type : "sneakers"
},
{
path : "<DATABASE_URL>/searchClothingPath"
index: "firebase",
type : "clothingDataModel",
fields: ['jeans','shirts']//completely optional to use
},
{
path : "<DATABASE_URL>/searchHatsPath"
index: "firebase",
type : "hatDataModel",
},
//etc...
-FYI Fields
是keys
将在 ES 中建立索引。这是一个可选的添加内容。如果你有 10 个keys
只想要其中 2 个indexed
然后你会添加这个。这意味着 10 个键中只有那 2 个keys
将是可搜索的。您还可以使用解析函数在 - 的里面config.js
文件做同样的事情
- 然后保存/关闭config.example.js
并重命名它config.js
4.路线:
4A.打开config.example.js
文件并在第 13 行更改exports.FB_URL = process.env.FB_URL || 'https://<YOUR APP>.firebaseio.com';
to exports.FB_URL = process.env.FB_URL || 'https://sneakersearch-az12.firebaseio.com';
4B.第 23 行用于访问service-account.json
文件(只要您将其重命名为Unknown file
在步骤 3C 中继续)
4C.第 64、65、66 行是我想要监视的内容,在第 67 行我添加了fields key
为了两个人Firebase Database Keys
我想搜索,虽然没有必要
exports.paths = [
{
path : "https://sneakersearch-az12.firebaseio.com/searchSnkPath",//line 64
index: "firebase",//line 65
type : "sneakers",//line 66
fields: ['sneakercondition', 'sneakername']//line 67
},
4D.保存/关闭config.example.js
文件。现在重命名该文件config.js
.
5•node app.js(运行应用程序)
5.评论:
-直到最后你才会运行这个命令,所以现在跳过它,但有一些你应该知道的事情。跑步node app.js
在本地计算机上运行 Heroku 应用程序。它会在本地查找您没有的 ElasticSearch,因此您会收到连接错误。如果你想在本地运行它,那么你必须运行export BONSAI_URL="<your_bonsai_url>"
步骤 12B-可选的代码,需要它来解决本地连接错误。如果您的应用程序进入睡眠状态/崩溃(接近结束时),您将不得不运行export BONSAI_URL="<your_bonsai_url>"
再次命令。除此之外,当您将代码推送到 Heroku 时,Heroku 将自动运行该应用程序。
- 到目前为止,对于这一步,您需要打开您的app.js
文件并根据https://docs.bonsai.io/docs/nodejs添加一些代码。您应该在以下任意位置添加代码var elasticsearch = require('elasticsearch')
宣言。
/*
this code is already inside the app.js file. You should add the code anywhere below it
var elasticsearch = require('elasticsearch'),
conf = require('./config'),
fbutil = require('./lib/fbutil'),
PathMonitor = require('./lib/PathMonitor'),
SearchQueue = require('./lib/SearchQueue');
*/
//You need to add
var bonsai_url = process.env.BONSAI_URL;
var client = new elasticsearch.Client({
host: bonsai_url,
log: 'trace'
});
// Test the connection...
client.ping({
requestTimeout: 30000,
hello: "elasticsearch"
},
function (error) {
if (error) {
console.error('>>>My Bonsai url is>>>' + bonsai_url)
console.error('>>>Elasticsearch cluster is down!');
} else {
console.log('All is well');
}
}
);
- 说明还说要运行 $export BONSAI_URL="https://username:[email protected]"
(换句话说export BONSAI_URL="<your_BONSAI_URL>"
)只有当您想在本地运行应用程序以使用 ES 时,您才会这样做。它不适合远程
5.路线:
5.打开app.js
文件并添加以下代码并保存文件:
var bonsai_url = process.env.BONSAI_URL;
var client = new elasticsearch.Client({
host: bonsai_url,
log: 'trace'
});
// Test the connection...
client.ping({
requestTimeout: 30000,
hello: "elasticsearch"
},
function (error) {
if (error) {
console.error('>>>My Bonsai url is>>>' + bonsai_url)
console.error('>>>Elasticsearch cluster is down!');
} else {
console.log('All is well');
}
}
);
6•curl -X POSThttp://localhost:9200/firebase
6.评论:
- 跳过这一步,因为此时你还没有本地ES
在你的CPU上建立索引
6.路线:
6.跳过此步骤
7•CD手电筒
7.评论:
-不需要运行这个,你应该仍然在你的flashlight
folder
7.路线:
7.跳过此步骤
8·heroku登录
8.评论:
- 打开终端
-您必须输入您的Heroku
's email address
and password.
当您输入密码时,它将显示为空白
8.路线:
8A. run: heroku login
8B.根据提示输入您的email address
and password
登录 Heroku
9•heroku create(将heroku添加到项目中)
9.评论:
-这就是为什么你不需要创建一个heroku
应用程序在步骤 1D。现在您将创建并命名您的 heroku 应用程序
- 输入后create
您需要输入您想要的 Heroku 应用程序名称。即我选择名字sneakersearchinstanceAtoZ
- 运行此命令后,如果您登录Heroku
您应该会看到列出的应用程序名称。转到右上角,单击9 dots
, 选择Dashboard
9.路线:
9. run: heroku create sneakersearchinstanceAtoZ
10•heroku插件:添加盆景(安装盆景)
10.评论:
- 您需要添加一个credit card
给你的Heroku
在运行此步骤之前先登录帐户,否则运行后它会说您必须执行此操作。但它仍然是一个免费计划。我不确定你是否可以添加Bonsai add on
没有卡
- 要添加信用卡,请一直转到右侧,单击圆形图标,然后选择Account Settings
,然后选择Billing
-您现在需要添加bonsai
给你的heroku app
。你可以通过运行来做到这一点heroku addons:add bonsai --app <your-app-name>
-<your-app-name>
是无论什么heroku
您在第 9 步中创建的应用程序的名称
- 创建后bonsai cluster
然后它会要求你通过运行来打开集群heroku addons:open bonsai
10.路线:
10A.登录到Heroku
并将信用卡添加到Billing Page
10B. run: heroku addons:add bonsai --app sneakersearchinstanceAtoZ
//与步骤 9 中的名称完全相同
10C. run heroku addons:open bonsai
11•heroku 配置(检查盆景实例信息并复制新的
BONSAI_URL 您稍后将需要它)
11.评论:
-跑步heroku config
将会得到你所有的environment variables
及其对应的值。当你看到你的bonsai's url
,复制它的值,您将在步骤 12B 和 17 中需要它
-这与您在步骤 10C 中看到的 URL 完全相同
-The bonsai url
可能看起来像https://abc123a01:[email protected]
11.路线:
11A. run: heroku config
11B.复制bonsai url
返回的
12·heroku config:set FB_NAME= FB_TOKEN="" (声明
环境变量)
12.评论:
需要 -12A。您需要使用您的项目GoogleService-Info.plist
's PROJECT_ID
哪一个是FB_NAME
和API_KEY
哪一个是FB_TOKEN
对于这一步
-12B 是可选的。如果您想连接到ElasticSearch
本地运行这个。你必须设置你的bonsai url
这样运行node app.js
不会抛出连接错误。您可以通过运行以下命令来执行此操作:export BONSAI_URL="<your_bonsai_url>"
。您将需要在每个终端会话或您的 Heroku 应用程序休眠/崩溃时运行此命令。
- 等号前后不要使用空格
12.路线:
12A(必需)。 run: heroku config:set FB_NAME=sneakersearch-az12 FB_TOKEN=0012abc789xyz00019
12B(可选).run: export BONSAI_URL="https://abc123a01:[email protected]"
13·git add config.js(更新)
13.评论:
-如果您运行此命令,您可能会收到一条错误消息:您的 .gitignore 文件之一会忽略以下路径:
配置文件
如果您确实想添加它们,请使用 -f 。
-它说要跑git add config.js
然后加-f
在最后
13.路线:
13A. run: git add config.js
13B.如果运行出现错误:git add config.js -f
14·git commit -m“配置盆景”
14.路线:
14. run: git commit -m "configure bonsai"
15•git Push heroku master(部署到heroku)
15.路线:
15. run: git push heroku master
16•heroku ps:scaleworker=1(启动dynoworker)
16.评论:
- 该命令的作用的答案就在这里有人可以解释一下“heroku ps:scale web=1”
16.路线:
16. run: heroku ps:scale worker=1
17•curl -X POST /firebase (例如:https://用户名:[电子邮件受保护]/firebase)
17.评论:
-在开始此步骤之前,请阅读@DoesData更新的答案(在我的下面)以使用curl -X PUT而不是POST
-抓住bonsai url
您从步骤 11B 复制
- 将网址粘贴到curl -X POST
命令并确保添加/firebase
到最后
-它的作用是创建一个名为/firebase
这指向你的bonsai url
。打开你的config.js
文件并查找exports.paths
(第 62 行)。它有一个名为的键/值对index: "firebase"
(第65行),该值指向您刚刚创建的索引并从那里访问ES集群
-基本上在你的 config.js 文件中,第 65 行index
value firebase
必须与名称完全匹配/firebase
你添加到最后curl -X POST
命令。如果名称不匹配,那么这些都不起作用。
- 如果成功,您应该得到以下响应:{"acknowledged":true}
17.路线:
17. run: curl -X POST https://abc123a01:[email protected]/firebase
18•现在可以使用第 5 步 node app.js(运行应用程序)
18.评论:
-运行此命令将在本地启动应用程序。你也可以运行npm start
但无论哪种方式,它都会在您的本地计算机上启动它,并且您需要运行步骤 12B(可选)中的代码才能使其工作
18.方向
18. run: node app.js
19• 设置您的映射对象
仅供参考,第 19 步非常重要。您必须设置您的映射对象及其键。我没有足够的字符来详细解释它。这就是第 4 步的内容type
键用于设置。观看此视频,了解如何设置您的mappings object
:
19.路线:
19A. --open TextEdit
or Sublime
然后创建一个文件并命名sneakerfile.json
。保存并将文件拖到您的flashlight
文件夹。你需要.json
扩大。
19B.- 在该文件中添加以下代码,保存并关闭文件:
{
"sneakers": {
"properties": {
"sneakercondition": {
"type": "string"
},
"sneakername": {
"type": "string"
}
}
}
}
//notice this is just like the Swift Sneakers Data Model declared at the beginning
19C.抓住你的BONSAI_URL
run heroku config:get BONSAI_URL
. My 盆栽_URL is https://abc123a01:[电子邮件受保护]
19D. run: curl -XPOST https://abc123a01:[email protected]/firebase/sneakers/_mapping [email protected]
19E. run: curl -XGET <BONASI_URL>/firebase/sneakers/_mapping?pretty
完成第 1 部分。第 2 部分将详细解释步骤 19
更多信息-
Heroku 命令:
检查您的dyno
run: heroku ps
如果您看到以下内容,请参阅下面的链接
=== web (Free): npm start (1)
web.1: crashed 2017/01/01 12:00:00 -0500 (~ 38m ago)
=== worker (Free): node ./app.js (1)
worker.1: crashed 2017/01/01 12:00:00 -0500 (~ 10m ago)
创建您的后Heroku app
your dyno
是在Heroku Free Plan
。最终会fall asleep
/crash
如果在一定时间内没有使用。要停止睡眠/崩溃,请遵循
防止 Heroku 空转的简单方法?
https://devcenter.heroku.com/articles/free-dyno-hours
https://devcenter.heroku.com/articles/dyno-sleeping
其他命令:
heroku help //help
heroku status //Heroku platform status
heroku logs //displays 100 logs
heroku logs --tail //realtime logs
heroku logs --tail | grep worker //dyno worker logs
heroku ps -a <heroku app name> //how many dyno hrs you have left
heroku config:get BONSAI_URL //gets only your bonsai url
heroku config //all your environment variables
heroku apps:info //your Heroku credentials
回到 command prompt
press Ctrl+C
您还可以联系 Heroku 支持或 Bonsai 支持,因为他们非常有帮助
我很快就会发布第 2 部分。