Syntax error in database rules while deploying - firebase-realtime-database

While deploying my website to firebase,i get a syntax error in database rules showing:
2:5: Expected rules property.
I am listing down the code in json
{
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"database": {
"rules": "firebase.json"
},
"emulators": {
"auth": {
"port": 9099
},
"database": {
"port": 9000
},
"hosting": {
"port": 5000
},
"ui": {
"enabled": true
}
}
}

The rules value should point to a rules file, not at the firebase.json file itself. Something like:
"rules": "database.rules.json"
That rules file must define valid database rules. For example:
{
"rules": {
".read": false,
".write": false
}
}

Related

releases.atom\n\nplease double check that your authentication token is correct. why?

in main.ts
autoUpdater.on('error', e => {
dialog.showMessageBox(win, { message: (e as Error).message });
});
in package.json
"build": {
"appId": "com.github.orgname.reponame",
"win": {
"target": "nsis",
"icon": "dist/apps/frontend/assets/app"
},
"nsis": {
"oneClick": false
},
"asar": true,
"directories": {
"output": "releases/"
},
"files": [
"**/*",
"!**/*.ts",
"!*.map",
"!package.json",
"!package-lock.json",
{
"from": "../dist",
"filter": ["**/*"]
}
],
"portable": {
"splashImage": "dist/apps/frontend/assets/app/preloader.png"
}
}
How to fix this error? How can I make it so that the user can receive updates when there is a release in github? Where to enter the token so that each client can auto-renew?
You will have to provide a personal access token to electron-updater for it to work.
The quick and dirty fix I used:
autoUpdater.setFeedURL({
provider: 'github',
repo: 'REPOSITORY_NAME',
owner: 'OWNER_OF_REPOSITORY',
private: true,
token: '<PERSONAL_ACCESS_TOKEN_REFERENCE>'
})
I understand it might not be clear how to go about adding the PERSONAL_ACCESS_TOKEN_REFERENCE securely. Inputs to this answer are welcome.

Hyperledger Explorer with Fabric v2.4.2 enable to find other peer

I try to use two connection-profile to setup the explorer. But I find there is always only 1 nodes, and in the "NETWORK" can only find orderer and the network I loggin. Here's the file I config.
only one peer
I use docker logs and find
[ERROR] FabricClient - Error: DiscoveryService has failed to return results
at DiscoveryService.send (/opt/explorer/node_modules/fabric-common/lib/DiscoveryService.js:370:10)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async NetworkImpl._initializeInternalChannel (/opt/explorer/node_modules/fabric-network/lib/network.js:279:13)
at async NetworkImpl._initialize (/opt/explorer/node_modules/fabric-network/lib/network.js:231:9)
at async Gateway.getNetwork (/opt/explorer/node_modules/fabric-network/lib/gateway.js:330:9)
config.json
{
"network-configs": {
"org1-network": {
"name": "org1-Network",
"profile": "./connection-profile/org1-network.json"
},
"org2-network": {
"name": "org2-Network",
"profile": "./connection-profile/org2-network.json"
}
},
"license": "Apache-2.0"
}
org1-network.json
{
"name": "org1-network",
"version": "1.0.0",
"client": {
"tlsEnable": true,
"adminCredential": {
"id": "exploreradmin1",
"password": "exploreradminpw"
},
"enableAuthentication": true,
"organization": "Org1MSP",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org1.example.com": {}
}
}
},
"organizations": {
"Org1MSP": {
"mspid": "Org1MSP",
"adminPrivateKey": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1#org1.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org1.example.com"],
"signedCert": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/users/User1#org1.example.com/msp/signcerts/User1#org1.example.com-cert.pem"
}
}
},
"peers": {
"peer0.org1.example.com": {
"tlsCACerts": {
"path": "/tmp/crypto/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/tls/ca.crt"
},
"url": "grpcs://peer0.org1.example.com:7051"
}
}
}
org2-network.json
{
"name": "org2-network",
"version": "1.0.0",
"client": {
"tlsEnable": true,
"adminCredential": {
"id": "exploreradmin2",
"password": "exploreradminpw"
},
"enableAuthentication": true,
"organization": "Org2MSP",
"connection": {
"timeout": {
"peer": {
"endorser": "300"
},
"orderer": "300"
}
}
},
"channels": {
"mychannel": {
"peers": {
"peer0.org2.example.com": {}
}
}
},
"organizations": {
"Org2MSP": {
"mspid": "Org2MSP",
"adminPrivateKey": {
"path": "/tmp/crypto/peerOrganizations/org2.example.com/users/User2#org2.example.com/msp/keystore/priv_sk"
},
"peers": ["peer0.org2.example.com"],
"signedCert": {
"path": "/tmp/crypto/peerOrganizations/org2.example.com/users/User2#org2.example.com/msp/signcerts/User2#org2.example.com-cert.pem"
}
}
},
"peers": {
"peer0.org2.example.com": {
"tlsCACerts": {
"path": "/tmp/crypto/peerOrganizations/org2.example.com/peers/peer0.org2.example.com/tls/ca.crt"
},
"url": "grpcs://peer0.org2.example.com:9051"
}
}
}
docker-compose.yaml
docker-compose.yaml
As you are using Org1 and Org2, I assume that you have used the existing tutorial scripts to create your network. However, if you want to have two separate networks running side by side, you will have to start a new network under a new folder - this is just so that you can make changes without getting confused.
Running two networks means that you have to start again with your scripts and change everything, e.g. conflicting names, port numbers, etc. If you want Org2 to belong to org2-network, then you should ensure that no other peers are defined along the way e.g. docker files, config files, etc. Your Org2 will need a separate Orderer running on a different port.
Try to get one network running first, then try building the second one while the first is running. If you get no errors, then you will eventually have two separate networks running. After that, you should be able to point to them in your config file as long as you are using the correct connection profile settings for each network.

how can JAVA_OPTIONS added in deployconfig in OpenshiftContainer

I am trying to add below JAVA_OPTIONS in deployconfig in OpenshiftContainer but is throwing syntax error .Could anyone help me how to add parameters in OpenshiftContainer please
JAVA_OPTIONS
-Djavax.net.ssl.trustStore={KEYSTORE_PATH}/cacerts.ts,
-Djavax.net.ssl.trustStorePassword=changeit,
Djavax.net.ssl.keyStore=${KEYSTORE_PATH}/keystore.pkcs12-Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASS}
-Djava.awt.headless=true,
deploymentConfig as json:
{
"apiVersion": "apps.openshift.io/v1",
"kind": "DeploymentConfig",
"metadata": {
"labels": {
"app": "${APP_NAME}"
},
"name": "${APP_NAME}"
},
"spec": {
"replicas": 1,
"selector": {
"app": "${APP_NAME}",
"deploymentconfig": "${APP_NAME}"
},
"strategy": null,
"template": {
"metadata": {
"labels": {
"app": "${APP_NAME}",
"deploymentconfig": "${APP_NAME}"
}
},
"spec": {
"containers": [
{
"env": [
{
"name": "SPRING_PROFILE",
"value": "migration"
},
{
"name": "JAVA_MAIN_CLASS",
"value": "com.agcs.Application"
},
{
"name": "JAVA_OPTIONS",
"value":"-Djavax.net.ssl.trustStore={KEYSTORE_PATH}/cacerts.ts",
"-Djavax.net.ssl.trustStorePassword=changeit",
-Djavax.net.ssl.keyStore=${KEYSTORE_PATH}/keystore.pkcs12
-Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASS}
-Djava.awt.headless=true,
},
{
"name": "MONGO_AUTH_DB",
"valueFrom": {
"secretKeyRef": {
"key": "spring.data.mongodb.authentication-database",
"name": "mongodb-secret"
}
}
},
],
"image": "${IMAGE_NAME}",
"imagePullPolicy": "Always",
"name": "${APP_NAME}",
"ports": [
{
"containerPort": 8103,
"protocol": "TCP"
}
],
"resources": {
"limits": {
"cpu": "500m",
"memory": "1Gi"
},
"requests": {
"cpu": "500m",
"memory": "500Mi"
}
},
"volumeMounts":[
{
"name": "secret-volume",
"mountPath": "/mnt/secrets",
"readOnly": true
}
]
}
],
"volumes": [
{
"name": "secret-volume",
"secret": {
"secretName": "keystore-new"
}
}
]
}
}
}
}
{
"name": "JAVA_OPTIONS",
"value":"-Djavax.net.ssl.trustStore={KEYSTORE_PATH}/cacerts.ts",
"-Djavax.net.ssl.trustStorePassword=changeit",
-Djavax.net.ssl.keyStore=${KEYSTORE_PATH}/keystore.pkcs12
-Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASS}
-Djava.awt.headless=true,
},
This is invalid json, as the key value can only have one value, while you have provided multiple comma separated strings.
JAVA_OPTIONS isn't a standard environment variable, so we don't know how it's processed but maybe this will work?
{
"name": "JAVA_OPTIONS",
"value":"-Djavax.net.ssl.trustStore={KEYSTORE_PATH}/cacerts.ts -Djavax.net.ssl.trustStorePassword=changeit -Djavax.net.ssl.keyStore=${KEYSTORE_PATH}/keystore.pkcs12 -Djavax.net.ssl.keyStorePassword=${KEYSTORE_PASS} -Djava.awt.headless=true"
},
But there's still probably an issue, because it seems like {KEYSTORE_PATH} is supposed to be a variable. That's not defined or expanded in this file. For a first attempt, probably just hardcode the values of all these variables.
For secrets (such as passwords) you can hardcode some value for initial testing, but please use OpenShift Secrets for formal testing and the actual deployment.

asp net core docker serilog configuration

I have a dot net core 3.1 app that is configured to run in docker containers.
While I have managed to update simple appsettings config using docker -e flag, I am still confused when it comes to a bit complex configuration, for example, serilog config.
appsettings file:
{
"AllowedHosts": "*",
"ConnectionStrings": {
"DefaultConnection": "Host=172.18.101.65;Port=5432;Username=postgres;Password=pgadmin;Database=identityserver;"
},
"Serilog": {
"Using": [],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcesssId", "WithThreadId" ],
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "File",
"Args": {
"path": "D:\\Logs\\IDSvr\\Log-.txt",
"outputTemplate": "{Timestamp:G} {Message}{NewLine:1}{Exception:1}",
"rollingInterval": "Day",
"shared": true
}
},
{
"Name": "Seq",
"Args": {
"serverUrl": "http://localhost:8081"
}
}
]
},
.
.
.
}
I could update the connection string using -e ConnectionStrings__DefaultConnection="..." flag, I am not sure how could I update the Serilog's WriteTo configuration section.
WriteTo is a complex object array. Hence, you have to specify the index you want to override. Lets say you want to override:
"Serilog": {
"WriteTo": [
{
"Name": "Console" // this value
},
...
You can select the key by -e Serilog__WriteTo__0__Name due to index 0 in the array. Then just pass it a value you want, like -e Serilog__WriteTo__0__Name=something.
To read that exact value in .NET Core Configuration, use Configuration["Serilog:WriteTo:0:Name"] in the startup pipeline.

hyperledger composer import identity optsmspid error

I have been able to set up a Google VPC with a Fabric topology of single org with two peers, all on different VM. I have Hyperledger composer on a separate VM and I am able to create a card with this connection profile
{
"name": "hlfv1",
"x-type": "hlfv1",
"x-commitTimeout": 300,
"version": "1.0.0",
"client": {
"organization": "Org0",
"connection": {
"timeout": {
"peer": {
"endorser": "300",
"eventHub": "300",
"eventReg": "300"
},
"orderer": "300"
}
}
},
"channels": {
"OneOrgsChannel": {
"orderers": [
"ordererorg0"
],
"peers": {
"peer0.org0": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
},
"peer1.org0": {
"endorsingPeer": true,
"chaincodeQuery": true,
"ledgerQuery": true,
"eventSource": true
}
}
}
},
"organizations": {
"Org0": {
"mspid": "Org0MSP",
"peers": [
"peer0.org0",
"peer1.org0"
],
"certificateAuthorities": [
"ca.org0"
]
}
},
"orderers": {
"ordererorg0": {
"url": "grpc://orderer0:7050"
}
},
"peers": {
"peer0.org0": {
"url": "grpc://peer0:7051",
"eventUrl": "grpc://peer0:7053"
},
"peer1.org0": {
"url": "grpc://peer1:7051",
"eventUrl": "grpc://peer1:7053"
}
},
"certificateAuthorities": {
"ca.org0": {
"url": "http://35.200.195.193:7054",
"caName": "ca.org0"
}
}
}
While, I am using composer card import I am getting error like this:
Failed to import Identity Error: Client.createUser Parameter 'opts
mspid' required.
I have hfc-key-store populated with the certificates of admin that fabric peers and orderers uses.
I have searched a lot what is this error, but it seems to be abstract.
If you still have this problem (or maybe others have) just remember to make sure you didn't make a typo in connection.json file. You always mention organisations in two places there: client section and organizations. Make sure those names are the same.

Resources