Following Para installation steps and getting "Connection failed. Run "para-cli setup" or check the configuration file" - para

I am on Ubuntu 20.04
The para jar is running.
I have followed the "Quick Start" steps in Erudika Para Github repo
At the step to run para-cli setup.
I am prompted for Para Access Key.
I am prompted for Para Secret Key.
I am prompted for Para Endpoint to which http://localhost:8080 is answered.
The file /home/ace/.config/para-cli-nodejs/config.json is generated and looks fine.
It matches the accessKey and secretKey from the previously executed curl command to http://localhost:8080/v1/_setup
The problem is para-cli setup ends with:
✔ New JWT generated and saved in
/home/ace/.config/para-cli-nodejs/config.json
✖ Connection failed. Run
"para-cli setup" or check the configuration file
/home/ace/.config/para-cli-nodejs/config.json
I am now stuck. Why is the connection failing?
This is the content of the config.json (this is a test app so secret key is not really secret)
{
"accessKey": "app:para",
"secretKey": "mMEzD6pTGhqbt8n4n3UMTBl1dH9dWTsK6KDThiDFyeLJLzrnRKXCug==",
"endpoint": "http://localhost:8080",
"jwt": "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1OTUwNDk0MDksImlhdCI6MTU5NDQ0NDYwOSwibmJmIjox>
}
This is the output of the initially run curl http://localhost:8080/v1/_setup
{
"accessKey" : "app:para",
"message" : "Save these keys - they are shown only once!",
"secretKey" : "mMEzD6pTGhqbt8n4n3UMTBl1dH9dWTsK6KDThiDFyeLJLzrnRKXCug=="
}

Make sure that your Para server is running and accessible from the machine you run para-cli on. Sometimes when your database is not configured properly the initialization of the root app is not persisted and the secret key you get changes each time you call curl http://localhost:8080/v1/_setup. Open http://localhost:8080/v1/_setup and make sure you see "All set!".
Use para-cli ping to test the connection to your Para server before creating a new app.

Related

How to push a docker image to remote registry with gradle in a spring boot project

I want to use that ./gradlew bootBuildImage comman to build a docker Image.
That command works perfectaly on my localmachine.
I have a remote docker registry on my server, and I want to push my Images from my local machine directly into my registry using bootBuildImage
To achieve that I added this into my build gradle.
tasks.named("bootBuildImage") {
docker {
builderRegistry {
username = "admin"
password = "secret-password"
url = "https://registry.myserver.com"
}
}
}
On ./gradlew bootBuildImage
I got this Error:
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':bootBuildImage'.
Docker API call to 'localhost/v1.24/images/create?fromImage=docker.io%2Fpaketobuildpacks%2Fbuilder%3Abase'
failed with status code 500 "Internal Server Error" and message "Head
"https://registry-1.docker.io/v2/paketobuildpacks/builder/manifests/base":
una uthorized: incorrect username or password"
Username & Password are 100% correct.
Probably it should be publishRegistry { ... }, not builderRegistry

How to setup password for elasticsearch users?

I am trying to enable security for my ES cloud. I am following these instructions:
https://www.elastic.co/guide/en/elasticsearch/reference/7.5/configuring-security.html
and I am stuck at point 6. When I try to run bin/elasticsearch-setup-passwords interactive I got error:
Failed to determine the health of the cluster running at http://XXX:9200
Unexpected response code [503] from calling GET http://XXX:9200/_cluster/health?pretty
Cause: master_not_discovered_exception
It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.
It is very likely that the password changes will fail when run against an unhealthy cluster.
Do you want to continue with the password setup process [y/N]
I try to check my ES instance state:
curl http://XXX:9200/_cluster/health?pretty
and get
{
"error" : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "missing authentication credentials for REST request [/_cluster/health?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type" : "security_exception",
"reason" : "missing authentication credentials for REST request [/_cluster/health?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status" : 401
}
So, looks like I cant setup a password because I can`t authenticate :) ?
Here is the official doc for setting up security for Elasticsearch
step 1:
cd /usr/share/elasticsearch/
step 2:
sudo bin/elasticsearch-setup-passwords auto
or
sudo bin/elasticsearch-setup-passwords interactive
auto - Uses randomly generated passwords interactive - Uses passwords
entered by a user
The above commands can help you to setup password
The following worked for me in Windows.
Ensure elastic node is up and running. In a separate prompt, from elasticsearch/bin, run the below command
elasticsearch-setup-passwords auto -u "http://localhost:9200"
Elastic will ask you for proceeding with the setup of auto generated password. Once you proceed with yes, you will be provide with the password for elastic/kibana/beats etc.
After some research I found that the Magento stores the credential in an XML file and it can be found in base directory:
+\magento\vendor\magento\module-elasticsearch-7\etc\config.xml. Please update your elastic password instead of XXXXXX and also in case you have chosen a different version of elastic, the location would be different.
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
<default>
<catalog>
<search>
<engine>elasticsearch7</engine>
<elasticsearch7_server_hostname>localhost</elasticsearch7_server_hostname>
<elasticsearch7_server_port>9200</elasticsearch7_server_port>
<elasticsearch7_index_prefix>magento2</elasticsearch7_index_prefix>
<elasticsearch7_enable_auth>1</elasticsearch7_enable_auth>
<elasticsearch7_username>elastic</elasticsearch7_username>
<elasticsearch7_password>XXXXXXXXXXX</elasticsearch7_password>nfog
<elasticsearch7_server_timeout>15</elasticsearch7_server_timeout>
<elasticsearch7_minimum_should_match/>
</search>
</catalog>
</default>
</config>
for the windows run the elk in cmd
open other cmd and past the command where the elk in folder
bin/elasticsearch-setup-passwords auto

Unable to start Angular 7 with SSL certificate connecting to spring cloud applications - PEM_READ_BIO_PRIVATEKEY:bad password read

we are developing a Spring cloud application with microservice architecture and have a self signed certificate.We have written the code and completed the SSL settings in back end successfully.
Now we try to set up the certificate in front end in Angular 7.
we made the following changes
1.Generated the SSL .crt and .key files.placed in SSL folder
2.Modified Angular.json file and included
"ssl": true,
"sslKey": "ssl/server.key",
"sslCert": "ssl/server.crt"
but when I start i am getting the following error
error:0907B068:PEM routines:PEM_READ_BIO_PRIVATEKEY:bad password read
I have found 2 helpful links
NodeJS & SSL - "bad password read"
https://github.com/angular/angular-cli/issues/1576
Please note that I don't want these two solutions
1.Running the front end code in back end server by placing the Angular 7 code in static folder
2.Removing the passphrase from the key.
Link1 says that we need to add the code
var credentials = {
key: fs.readFileSync('XXX.key', 'utf8'),
cert: fs.readFileSync('XXX.crt', 'utf8'),
passphrase: 'XXXX'
}
but where in Angular 7 we need to add the these settings
Thanks
Mahidhar

Getting an error while calling GET /system/ping

I am getting an error while calling GET /system/ping
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "error trying login and get user Context. Error: error trying to enroll user. Error: Enrollment failed with errors [[{\"code\":400,\"message\":\"Authorization failure\"}]]",
}
}
I have made the participant
Blockchain Participant
{
'$class': 'org.optum.blockchainv5.Participant',
ParticipantId: 'ParticipantId:2',
Name: 'Vipul Bajaj'
}
Then issued an identity to the participant
System Identity
{
userID: 'ParticipantId:2',
userSecret: 'dPJbJBsaOLaf'
}
And then added that identity to default wallet
Wallet Identity
{
enrollmentID: 'ParticipantId:2',
enrollmentSecret: 'dPJbJBsaOLaf',
id: 3
}
And then set this wallet identity default by calling the POST /wallets/1/identities/3/setDefault
Got response code 204
And after calling GET system/ping gave me error.
just following up - if you're still getting this error, could you attach a trace log setting export DEBUG=composer:* ` then re-running the rest server - the log file is in a 'logs' directory (from where you start the composer-rest-server). Then we can see what's going on with the POST.
I had a similar issue.
I was trying to deploy a composer hlfv1 network instance locally. I was running the ./createComposerProfile.sh script. This script has this line cp "${DIR}"/hlfv1/composer/creds/* ~/.hfc-key-store
This copies all the credentials on your creds folder and overrides the ones created by composer identity import on your ~/.hfc-key-store
You could copy the credentials from ~/.hfc-key-store to the creds folder or comment out this line.

Send email notification from Jenkins

I want to send email notification when any job gets done.
Please let me know how can we propagate.
You can configure Jenkins to send email when a job finishes either by using a plugin or not.
Built-in
First you have to configure your mail server settings by clicking on Manage Jenkins > Configure System and find the E-mail Notification section near the bottom of the page. Optionally also configure System Admin e-mail address in the Jenkins Location section.
Then for each job got to its configuration and Add post-build action, select E-mail Notification and configure as needed.
Plugin
The issue with default jenkins email mechanism is that it has very limited customization.
The alternate approach is to use the Email-Ext plugin, a powerful email notification mechanism. You can define some global triggers but you can also customize the settings for each job. Sending emails for success, failure or any other build status is supported.
Go to : manage jenkins --> manage plugins --> 'available' tab --> select 'email extension plugin' --> click on button 'install without restart'
manage jenkins --> configure system -->
enter details in 'email notification'
Fill up the details as given below and save it:
In the configuration of project/job , tick on the 'email notification' ---> enter the details ---> save it ---> build the job/project
There's a Jenkins email-ext plugin that adds triggers and recipients.
This answer is for sending mail using python script & outlook through Jenkins.
You need to have PsExec.exe for this. This runs the applications remotely.
create a freestyle project & in that run following dos shell command:
path\to\psexec.exe -u username -p password -i 1 cmd -accepteula /c python path\to\SendMail.py
Username & password is for the windows user account where outlook runs.
path\to\SendMail.py is the location of the python script.
SendMail.py kinda looks like this:
import win32com.client as win32
outlook=win32.Dispatch('outlook.application')
mail=outlook.CreateItem(0)
mail.To='abc#xyz.com'
mail.Subject="Test Mail"
mail.HTMLBody="Hiii, This is just a test mail."
mail.Send()
Here I'm using wind32com for executing outlook. The mail will be sent using the default account logged in outlook.
You can trigger to build this project everytime after a job completes.
Hope this is of any help to anyone :)
All the above answers are about plug-in and its usage but not how to use it in pipeline execution.
Assuming smtp server is configured in jenkins and https://plugins.jenkins.io/email-ext/ plug-in is installed , we can write or use the plug-in ij the below format.
def csproj_path = 'dotnetcore_sample.csproj'
pipeline {
agent{
node {
label 'dotnet-31'
}
}
stages {
stage ('build locally'){
steps{
sh "dotnet build ${csproj_path}"
}
}
stage ('Prompt check'){
steps {
mail to: 'bruce.wayne#gmail.com',
cc : 'clark.kent#gamil.com'
subject: "INPUT: Build ${env.JOB_NAME}",
body: "Awaiting for your input ${env.JOB_NAME} build no: ${env.BUILD_NUMBER} .Click below to promote to production\n${env.JENKINS_URL}job/${env.JOB_NAME}\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}"
timeout(time: 60, unit: 'MINUTES'){
input message: "Promote to Production?", ok: "Promote"
}
}
}
}
post {
failure {
mail to: 'mymail#gmail.com',
cc : 'ccedpeople#gamil.com'
subject: "FAILED: Build ${env.JOB_NAME}",
body: "Build failed ${env.JOB_NAME} build no: ${env.BUILD_NUMBER}.\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}"
}
success{
mail to: 'mymail#gmail.com',
cc : 'ccedpeople#gamil.com'
subject: "SUCCESSFUL: Build ${env.JOB_NAME}",
body: "Build Successful ${env.JOB_NAME} build no: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}"
}
aborted{
mail to: 'mymail#gmail.com',
cc : 'ccedpeople#gamil.com'
subject: "ABORTED: Build ${env.JOB_NAME}",
body: "Build was aborted ${env.JOB_NAME} build no: ${env.BUILD_NUMBER}\n\nView the log at:\n ${env.BUILD_URL}\n\nBlue Ocean:\n${env.RUN_DISPLAY_URL}"
}
}
}
The above declarative pipeline consists of below features
Send email for the respective user to promote the build to next level.
Email when build is successful.
Email when build is failed and also when it is aborted with link to the logs.
launch Jenkins.
access Manage Jenkins link from the main page.
go to the end of the page and fill Email notification details :
Click on Test notification to verify it is sending an email.
Please see the email sent from Jenkins.
If you wants to configure gmail account in Jenkins:
Launch the Jenkins
Click on Manage Jenkins from Left Pane.
Click on Configure System under the System configuration.
Under the Email Notification
Put the SMTP server as smtp.gmail.com in SMTP server field.
Click the Advance button and then select the "Use SMPT Authentication" checkbox to select it.
Enter valid gmail id and password (16 digit generated password) in Username and password field.
Select the "Use SSL" checkbox to select it.
Put the port no. as 465 in SAMP Port field.
Default the Charset as UTF-8.
Select the "Test configuration by sending test e-mail" checkbox to select it
Enter the same email id as entered in step 6 in "Test e-mail recipient" field.
Then click the Test configuration button.
If message displayed as "Email was successfully sent". it means you have successfully configured the email notification and perform the step 14. if the message displayed as "jakarta.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted..." so you have to need to generate 16 digit app password from google account
click on apply and save button
For generate app password:
Login with Gmail account.
Go to Account Setting >> Security.
Under the Signing in to Google
Enabled the 2-step verification, if required.
Click on App password
Entered the valid password.
click on select app dropdown and then select Other(Custom name) option
Enter the any name in field and then click Generate button.
copy the 16 digit code and paste the 16 digit code in password field in Jenkins Email configuration.
Then again click on Test configuration button under the "Test configuration by sending test e-mail"
Now you have to successfully configured the Email account in Jenkins

Resources