Working with docker and looking to update JSON with sed.
Here is the JSON :
var configLocalnet = {
version: '20180720',
websocket: {
protocol: 'http',
host: 'localhost',
port: '8082',
},
publicapi: {
protocol: 'http',
host: 'localhost',
port: '8082',
},
}
var configMainnet = {
version: '20180720',
websocket: {
protocol: 'https',
host: 'to_update',
port: '443',
},
publicapi: {
protocol: 'https',
host: 'to_update',
port: '443',
},
}
module.exports = process.env.REACT_APP_ENVIRONMENT === "mainnet" ? configMainnet : configLocalnet;
Need to the values in config var configMainnet to change to:
Both host details inside configMainnet should be changed to test.test.io
var configMainnet = {
version: '20180720',
websocket: {
protocol: 'https',
host: 'test.test.io',
port: '443',
},
publicapi: {
protocol: 'https',
host: 'test.test.io',
port: '443',
},
}
You may use:
sed -E "s/(host:.).+$/\1'test.test.io',/g"
Example:
echo "var configMainnet = {
version: '20180720',
websocket: {
protocol: 'https',
host: 'to_update',
port: '443',
},
publicapi: {
protocol: 'https',
host: 'to_update',
port: '443',
},
}" | sed -E "s/(host:.).+$/\1'test.test.io',/g"
var configMainnet = {
version: '20180720',
websocket: {
protocol: 'https',
host: 'test.test.io',
port: '443',
},
publicapi: {
protocol: 'https',
host: 'test.test.io',
port: '443',
},
}
Related
I have below two policy in my Values.yaml file. By default in policy one(USER_POLICY) I am allowing all the end point so i have just defined my context root(/v2/trans/brokerage/external) and allowed all http method. but out of it i just want exclude the endpoint(/v2/trans/brokerage/external/conditions) which comes under my SUPPORT_POLICY. how to exclude the endpoints specified in one policy with another Policy.
rules:
action: ALLOW
policies:
USER_POLICY:
principals:
- header: { name: "roles", contains_match: "ADMIN_ACCOUNT" }
permissions:
- and_rules:
rules:
- header: { name: ":path", prefix_match: "/v2/trans/brokerage/external" }
- or_rules:
rules:
- header: { name: ":method", exact_match: "GET" }
- header: { name: ":method", exact_match: "POST" }
- header: { name: ":method", exact_match: "PATCH" }
- header: { name: ":method", exact_match: "DELETE" }
Some syntax to exclude : /v2/trans/brk/ext/conditions
SUPPORT_POLICY:
principals:
- header: { name: "roles", contains_match: "SUPPORT" }
permissions:
- and_rules:
rules:
- url_path: { path: { prefix: "/v2/trans/brk/ext/conditions" } }
- or_rules:
rules:
- header: { name: ":method", exact_match: "GET" }
- header: { name: ":method", exact_match: "POST" }
As written in deno.land/x/mongo, to connect to mongo Atlas, such configuration should be use :
import { MongoClient } from "https://deno.land/x/mongo#v0.21.0/mod.ts";
const client1 = new MongoClient();
await client.connect({
db: "<db>",
tls: true,
servers: [
{
host: "<host>",
port: 27017,
},
],
credential: {
username: "<user>",
password: "<password>",
db: "<db>",
mechanism: "SCRAM-SHA-1",
},
});
const db = client1.database("TestingDB");
export default db;
There, <host>should be replaced by a specific cluster address (looks something like that : cluster0.hmdnu.mongodb.net) and not a full string as mongodb+srv://user1:MYPASSWORD#cluster0.hmdnu.mongodb.net/TestingDB?retryWrites=true&w=majority.
This solution works well. But there is, I believe, a downside : Sometimes, a Mongo cluster can fail and a Secondary cluster can become Primary. Has we are using a specific cluster on our code, that cluster might be down and our program as well. Any one encounter a similar issue ? and how did you resolve it ?
Add more cluster
servers: [
{
host: "<host>", /*primary*/
port: 27017,
},
{
host: "<host>", /*secondary*/
port: 27017,
},
{
host: "<host>", /*secondary*/
port: 27017,
},
],
I was very happy to learn that the new Meteor versions support Mongo v4.
It seems that MUP does not...
If I run 'mup setup' with these mongo settings in mup.js everything goes fine.
module.exports = {
servers: {
one: {
host: '****',
}
},
meteor: {
name: 'nascholingen',
path: '/webserver/nascholingen',
volumes:{
'/webserver/nascholingen/private/.uploads':'/webserver/nascholingen/private/.uploads',
'/webserver/nascholingen/private/.downloads':'/webserver/nascholingen/private/.downloads',
'/webserver/nascholingen/backups/nascholingen':'/webserver/nascholingen/backups/nascholingen'
},
servers: {
one: {
env:{
PDFMERGE_PATH: "/usr/bin/pdfmerge",
}
},
},
buildOptions: {
serverOnly: true,
},
env: {
ROOT_URL: '*****',
MONGO_URL: 'mongodb://localhost/meteor',
PORT:'3002'
},
docker: {
image: 'appworkshop/meteord-graphicsmagick-pdftk-node8:node-8.9.1-base',
},
deployCheckWaitTime: 60,
enableUploadProgressBar: false
},
mongo: {
port: 27017,
version: "3.6.16",
servers: {
one: {}
}
}
};
When I change 'version' to 4.0.6 or anything higher, mup setup shows:
Connection refused :
connect#src/mongo/shell/mongo.js:341:17
#(connect):2:6
2019-12-21T18:07:28.576+0000 F - [main] exception: connect failed
2019-12-21T18:07:28.576+0000 E - [main] exiting with code 1
MongoDB shell version v4.2.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
2019-12-21T18:07:33.737+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: ca
Any ideas?
I have deployed a meteor app to port 80 of my AWS instance using MUP. I deployed a second meteor app to port 3000, but this time omitting mongo setup and specifying mongo url in the mup.js file. The setup works fine and the second app is deployed but none of my publications seems to work. I have tried the same setup with two test Apps previously and it worked.
MUP.JS of App 1
module.exports = {
servers: {
one: {
host: 'IP',
username: 'ubuntu',
pem: 'path to my pem file'
}
},
meteor: {
name: 'Dashboard',
path: 'Path to my project',
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
docker: {
image: 'abernix/meteord:base',
},
env: {
PORT: 80,
ROOT_URL: 'base url/',
MONGO_URL: 'mongodb://mongodb:27017/dbname'
},
deployCheckWaitTime: 320,
enableUploadProgressBar: true
},
mongo: {
oplog: true,
port: 27017,
servers: {
one: {},
},
},
};
MUP.JS of App 2
module.exports = {
servers: {
one: {
host: 'IP',
username: 'ubuntu',
pem: 'path to my pem file'
}
},
meteor: {
name: 'DashBoard2',
path: 'Path to my project',
servers: {
one: {}
},
buildOptions: {
serverOnly: true,
},
docker: {
image: 'abernix/meteord:base',
},
env: {
PORT: 3000,
ROOT_URL: 'base url/',
MONGO_URL: 'mongodb://mongodb:27017/dbname'
},
deployCheckWaitTime: 320,
enableUploadProgressBar: true
},
};
Are you certain the connection to the database has been made? Typically the Meteor console will give an error if it can't connect to the MongoDB database. Also not sure if you have omitted your connection string, but it should be;
mongodb://user:password#server:port/database
I use sails 0.9.
Here is adapters.js code:
module.exports.adapters = {
mongo: {
module: 'sails-mongo',
host: 'localhost',
port: 27017,
user: '',
password: '',
database: 'tracker'
},
mongo2: {
module: 'sails-mongo',
host: 'localhost',
port: 27017,
user: '',
password: '',
}
};
And model:
module.exports = {
adapter: 'mongo2',
config: {
database: 'offer'
},
attributes: {
name: {
type: 'string',
unique: true,
required: true
}
}
};
From docs http://sailsjs.org/#!documentation/models i get that this model will be saved in database named "offer", but it use db named "sails". Looks like its just ignore config section of model.
What is my mistake?
You should put the database in adapter config itself
mongo2: {
module: 'sails-mongo',
host: 'localhost',
port: 27017,
user: '',
password: '',
database: 'offer'
}