How to set Data cube config file? - data-cube

I'm trying to work on a new project and I red about Data Cube that can really help me.
In order to use it and to try to work with it, I installed postgres as required on the official website: https://datacube-core.readthedocs.io/en/datacube-1.4.1/ops/db_setup.html
When trying to initialize the dataset with this command:
datacube -v system init
I get the error: "Error: No datacube config found"
As requested I added env var and tried to put the config file everywhere (home dir, default, current...)
config file:
[datacube]
db_database: datacube
# A blank host will use a local socket. Specify a hostname (such as localhost) to use TCP.
db_hostname:
# Credentials are optional: you might have other Postgres authentication configured.
# The default username otherwise is the current user id.
db_username: postgres
db_password: postgres
I'm using windows 10 with conda, python 3.8,
Do you know what I'm missing?
TIA

As provided in documentation -
Datacube looks for a configuration file in ~/.datacube.conf or in the
location specified by the DATACUBE_CONFIG_PATH environment variable.
Make sure you file name is datacube.conf and it is in the proper path

Related

Terraform throwing error:error configuring Terraform AWS Provider: The system cannot find the path specified

I was facing issue with running aws command via cli with certificate issue. So as per some blogs, I was trying to fix the issue using setx AWS_CA_BUNDLE "C:\data\ca-certs\ca-bundle.pem" command.
Now even after I removed the variable AWS_CA_BUNDLE from my aws configure file, terraform keeps throwing the below error on terraform apply.
Error: error configuring Terraform AWS Provider: loading configuration: open C:\data\ca-certs\ca-bundle.pem: The system cannot find the path specified.
Can someone please tell me where terraform/aws cli is taking this value from and how to remove it? I have tried deleting the entire aws config and credential files still this error is thrown, uninstall aws cli and reinstalling.
If its set in some system/environment variable, can you please tell me how to reset it to default value?
The syntax to add ca_bundle variable to config file is wrong.
Your config file should look like this
[default]
region = us-east-1
ca_bundle = dev/apps/ca-certs/cabundle-2019mar05.pem
But as I understand you want to use environment variable (AWS_CA_BUNDLE).
AWS_CA_BUNDLE:
Specifies the path to a certificate bundle to use for HTTPS certificate validation.
If defined, this environment variable overrides the value for the profile setting ca_bundle. You can override this environment variable by using the --ca-bundle command line parameter.
I would suggest remove environment variable (AWS_CA_BUNDLE) and add ca_bundle to config file. The delete .terraform folder and run terraform init
Go environment variables and delete the environment variable created by AWS_CA_BUNDLE. Shut down Terminal and again start. Run the commands now it will work properly.

Build Chainlink Node from Source, not sure how to reference GCP SQL instance

I've recently built a chainlink node from source (no Docker). When trying to start the node, it's still looking for a local postgresql so I receive this error:
You must set DATABASE_URL env variable. HINT: If you are running this to set up your local test database, try DATABASE_URL=postgresql://postgres#localhost:5432/chainlink_test?sslmode=disable logger=1.4.1#8843bef
This happens even when I have the environmental variable set to:
DATABASE_URL=postgresql://linkster:password#10.5.0.3:5432/link
Also I have this set in a .env where I'm trying to start the node.
I know the GCP SQL instance, database and user exists since I can log in successfully using this:
PGPASSWORD=password psql -h 10.5.0.3 -p 5432 -d "link" -U "linkster"
Looking through the menu, I don't see a way to reference an external database. Did I miss something? Or is there a directory I need to have the .env file?
looking at the node source code, .env files are not natively supported. The only reason they work with running a node through docker, is because docker can take a --env-file parameter, which it then uses to create the environment variables for the container.
When running from source, you should manually set all environment variables in the environment that you're in. eg:
export DATABASE_URL=postgresql://linkster:password#10.5.0.3:5432/link

Gobuffalo error "There is no connection named development defined!"

In my go project I install gobuffalo:
go get github.com/gobuffalo/pop/...
And then I run soda migrate but I got this error There is no connection named development defined!
Does anyone know what problem I am facing with?
First a quick reply, explanation below.
Delete the database.yml file.
Force soda to create the same file with the command "soda g config"
After that my "soda migrate" command stopped giving the error and worked. (Don't forget to put your db cofig details in the generated file in the first section (development) only)
In Detail
Actually I copied an old working directory of Go to create another one. In the new place it was not working. I think that was the problem. If still not working try installing SODA and do the above in the new place, I did that also.
https://gobuffalo.io/documentation/database/soda/
https://gobuffalo.io/documentation/database/configuration/
For me, I named the file database.yaml initially, changing the name of file to database.yml worked just fine.
Please ensure you don't have any formatting extension's available I was initially getting the same issue later resolved by 'uninstalling' prettier.
Steps I followed:
'soda g config' and edit your database.yml (make sure it is 'database.yml')
I was also creating some Fizz migrations 'soda generate fizz table_name'
Edit changes to the database.yml file (I am using Dbeaver by default it usually asks you to set user as 'postgres' and if you have any password set in order to make connection with 'postgres' you can use that same password in the password)
i.e
development:
dialect: postgres
database: db_name
user: postgres
password: ****
host: 127.0.0.1
pool: 5
now you can use 'soda migrate' or 'soda migrate up' in case you have some
code there for creating a table
may this approach helps :)

Mongodb start error with security.authorization enabled

I am getting an error attempting to start mongo with authorization enabled via the security.authorization configuration parameter (see http://docs.mongodb.org/manual/reference/configuration-options/#security.authorization)
On running mongod I get
Error parsing INI config file: unknown option security.authorization
try 'mongod --help' for more information
Any idea?
Thanks
Supporting data:
Mongo version 2.6.0 (installed via homebrew)
OSX Mavericks 10.9.2
start command:
mongod -f /usr/local/etc/mongod.conf
mongod.conf file (works fine if I comment out security.authorization):
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
# Only accept local connections
bind_ip = 127.0.0.1
# auth
security.authorization = enabled
#security.authenticationMechanisms = MONGODB-CR #error occurs with or without this
No entry is made in the mongo.log file when this occurs
Note: I would have written this as a comment, however I do not have the points yet.
Just wondering whether what you are trying to achieve is authentication instead? If this is the case, all you need to set in mongodb.conf is:
# auth
auth = true # true or false. Whether or not authentication is required.
-- UPDATED:
Some other steps that are important:
Configure the db location: Set in mongodb.conf as (you already have this, but should check the directory and permissions exist):
# Store data in /usr/local/var/mongodb instead of the default /data/db
dbpath = /usr/local/var/mongodb
# Append logs to /usr/local/var/log/mongodb/mongo.log
logpath = /usr/local/var/log/mongodb/mongo.log
logappend = true
Dont forget to make sure the above /usr/local/var/mongodb directory and /usr/local/var/log/mongodb/ directory exist. The installer that you used may not have made them.
Create an Operating System user for mongodb: (If one has not already been created - this is how on linux, not sure for osx) - as root:
adduser --system --no-create-home --disabled-login --disabled-password --group mongodb
Add permissions to folders if they are not already set:
chown mongodb:mongodb -R /usr/local/var/mongodb
To setup database user authorization / privileges:
See the command reference here: http://docs.mongodb.org/manual/reference/command/#database-commands
MongoDB server config file format changed from version 2.6 and still old format works.
http://docs.mongodb.org/manual/reference/configuration-options/
Changed in version 2.6: MongoDB introduces a YAML-based configuration file format. The 2.4 configuration file format remains for backward compatibility.
The error is due to the reason your config file is using old format and adding parameter security.authorization = enabled using new format.You can fix the problem by
using old format settings mentioned at http://docs.mongodb.org/v2.4/reference/configuration-options
auth = true
or by converting conf file to new YAML format.

AWS Command Line Interface Unable to Locate Credentials - Special Permissions

Okay, so I've encountered an insanely frustrating problem while trying to reach an AWS S3 Bucket through AWS CLI via the command prompt in Windows 7. The AWS CLI is "unable to locate credentials" a.k.a. the config.txt file # C:\Users\USERNAME\.aws\config.txt.
I've tried pathing to it by creating the AWS_CONFIG_FILE environmental variable in ControlPanel>System>AdvancedSystemSettings>EnvironmentalVariables, but no dice. I've also tried all of the above on another Win7 machine. Again, no dice.
What could I be missing here. Are there any special permission that need to be set for AWS CLI to accest config.txt? Help, before I poke my own eyes out!
The contents of config.txt, in case you're interested, are:
[default]
aws_access_key_id = key id here
aws_secret_access_key = key here
region = us-east-1
There is a another way to configure aws credentials while using command line tool.
You can pass credentials using windows command instead of passing through file.
Execute below command from windows command prompt
aws configure
It prompt you to enter below things
AWS Access key ID:
AWS secrete key ID:
Default region Name:
Default output Format:
See this video tutorial: https://youtu.be/hhXj8lM_jBs
Okay, so the config file cannot be a text file (.txt). You should create the file in CMD, and it should be a generic file w/o any extension.
A couple of points on this as I had similar problems whilst trying to perform an S3 sync.
My findings were as follows.
Remove the spaces between hte = and the key value pair (see example below).
The OP has specified a [default] section in their example, but I got the same error when I had removed this section as I did not think it was needed so it's worth nothing this is needed.
I then reformed my file as follows and it worked...
[default]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2
[deployment-profile]
aws_access_key_id=****
aws_secret_access_key=****
region=eu-west-2
I had to include a blank line at the bottom of my credentials file.
Just posting this really as I struggled for a few hours with vague messages from AWS and these were the solutions that worked for me. Hope that it helps someone.
If like me you have a custom IAM user in your credentials file rather than 'default', try setting the AWS_DEFAULT_PROFILE env variable to the name of your IAM user, and then running commands.
[user1]
ACCESS_KEY=
SECRET_KEY=
set AWS_DEFAULT_PROFILE=user1
aws <command>
Alternatively you can specify the --profile variable each time you use the cli:
aws <command> --profile user1

Resources