Having issues with setting up yii2 basic framework and ibm bluemix - yii2

Having issues with setting up yii2 basic framework and ibm bluemix.
I was using this link as a guide: https://github.com/Twanawebtech/yii2App-Bluemix/blob/master/README.md
Step 1a: clone the code and setup
Open your terminal
$ git clone https://github.com/Twanawebtech/yii2App-Bluemix.git
$ cd yii2App-Bluemix
Step 1b: Set cookie validation key in config/web.php file to some random secret string:
'request' => [
// !!! insert a secret key in the following (if it is empty)
- this is required by cookie validation
'cookieValidationKey' => '<secret random string goes here>',
],
Step 1c: You can then access the application through the following URL:
http://localhost/yii2App-Bluemix/web
you should see the Congratulations Screen
Step 1d: Manifest
Go back to the yii2App-Bluemix folder
and open the manifest file
rename name and host to the name you want to call it.
Go to the command prompt and using cloud Foundary CLI (once you have setup cloud Foundary CLI)
enter cf login
API endpoint: https://api.ng.bluemix.net
enter Email Address:
enter Password:
Select a space (if you have more than one space allocated)
Step 2: Push your code to Bluemix
$ cf push yii2App-Bluemix -b https://github.com/cloudfoundry/php-buildpack.git -s cflinuxfs2
Step 3: Access your app by entering the following URL into your browser:
http://yii2basic.mybluemix.net/yii
However I don't get the congratulations screen but instead I get the following which is the source code of the index.php file found in the web folder
What am I missing or forgot to do???

Related

Github Action Run - Security import is showing "One or more parameters passed to a function were not valid"error

I built the input file (decoded base64 file into p12 file) as CERTIFICATE_PATH, P12_PASSWORD is password in secret, KEYCHAIN_PATH is defined. when I run the command on CLI, I get "1 item imported" success message. but when I run from *.yml file on GitHub action, I get "security: SecKeychainItemImport: One or more parameters passed to a function were not valid." error. any suggestions?
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
CERTIFICATE_PATH - file that contains cert.p12 data,
KEYCHAIN_PATH is TEMP/app-signing.keychain-db
Another reason in Github actions could be that you are using the wrong environment.
Take a look at this ---> Difference between Github's "Environment" and "Repository" secrets?.
Set the right environment:
environment: production
found the issue.. was passing wrong cert file.. once added correct file in the security build , was able to get it working

How to deploy dockerhub or redhat container catalog (external registries) images in minishift

I'm studying openshift from and administration perspective and it is costing me a lot to understand it and one thing that I want to do is to deploy known containers into it and all I can do with minishift is deploy examples it provides or push a local develop which is not helpful to my purpose but I can't find a 'how to' of linking minishift cdk (the one from redhat) to external repositories like dockerhub or registry.access.redhat.com
Any help will be really appreciated.
What I did was:
Connect to minishift docker service
> $ eval $(minishift docker-env)
Tried to pull from redhat container catalog.
$ docker pull registry.access.redhat.com/openshift3/jenkins-2-rhel7:3.11.98-6
Trying to pull repository registry.access.redhat.com/openshift3/jenkins-2-rhel7 ...
error parsing HTTP 404 response body: invalid character 'F' looking for beginning of value: "File not found.\""
$ docker pull registry.redhat.io/openshift3/jenkins-2-rhel7:3.11.98-6
Trying to pull repository registry.redhat.io/openshift3/jenkins-2-rhel7 ...
unable to retrieve auth token: 401 unauthorized
$ docker login registry.redhat.io
Username: ********
Password:
WARNING! Your password will be stored unencrypted in /home/cesar.cabral/.docker/config.json.
Configure a credential helper to remove this warning. See https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
$ docker pull registry.redhat.io/openshift3/jenkins-2-rhel7:3.11.98-6
Trying to pull repository registry.redhat.io/openshift3/jenkins-2-rhel7 ...
> error parsing HTTP 404 response body: invalid character 'F' looking for beginning of value: "File not found.\""
tried the same but with dockerhub, no luck either.
$ docker pull hub.docker.com/nginx:1.17.0
Trying to pull repository hub.docker.com/nginx ...
Pulling repository hub.docker.com/nginx
invalid character '<' looking for beginning of value

Hyperledger Composer CLI Ping to a Business Network returns AccessException

Im trying to learn Hyperledger Composer but seems to be a relatively new technology, i mean there are few tutorials and few solutions to a lot of questions, tutorial does not mention possible error case when following the commands and which means there are is also no solution for those errors.
I have joined the composer channel in their community chat, looks like its running in Discord or something, and asked the same question without a response, i have a better experience here in SO.
This is the problem: I have deployed my business network, installed it, started it, created my network admin card and imported it, then to test if everything is ok i have to command composer network ping --card NAME-OF-MY-ADMIN-CARD
And this error comes:
juan#JuanDeDios:~/proyectos/inovacion/a3-poliza-microservice$ composer network ping --card admin#a3-policy-microservice
Error: transaction returned with failure: AccessException: Participant 'org.hyperledger.composer.system.NetworkAdmin#admin' does not have 'READ' access to resource 'org.hyperledger.composer.system.Network#a3-policy-microservice#0.0.1'
Command failed
I think that it has to do something with the permission.acl file, and gave permission to everyone to everything so there would not be any restrictions to anyone, and tryied again, but failed.
So i thought i had to uninstall my business network and create it again, i deleted my .bna and my network.card files also so everything would be created again, but the same error result.
My other attempt was to update the business network, but didn't work, the same error happened and I'm sure i didn't miss any step from the tutorial. I do also followed the playground tutorial. What i have not done its to create another app with the Yeoman but i will do if i don't find a solution to this problem which would not require me to create another app.
This were my steps:
1-. Created my app with Yeoman
yo hyperledger-composer:businessnetwork
2-. Selected Apache-2.0 for my license
3-. Created a3-policy-microservice as the name of the business network
4-. Created org.microservice.policy (Yeah i switched names but Im totally aware)
5-. Generated my app with a template selecting the NO option
6-. Created my assets, participants and transactions
7-. Changed my permission rules to mine
8-. I generated the .bna file
composer archive create -t dir -n .
9-. Then installed my bna file
composer network install --card PeerAdmin#hlfv1 --archiveFile a3-policy-microservice#0.0.1.bna
10-. Then started my network and created my networkadmin card
composer network start --networkName a3-policy-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
11-. Imported my card
composer card import --file networkadmin.card
12-. Tried to ping my network
composer network ping --card admin#a3-poliza-microservice
And the error happens
Later i tried to create everything again shutting down my fabric and started it again and creating the network from the first step.
My other attempt was to change the permissions and upgrade my bna network, but it failed too. Im running out of options
Hope this description its not too long to ignore it. Thanks in advance
thanks for the question!
First possibility is that your network name is a3-policy-network but you're pinging a network called a3-poliza-microservice - once you do get the correct ACLs in place (currently, that's the error you're trying to resolve).
The procedure for upgrade would normally be the procedure below:
After your step 12 (where you can't ping the business network due to restrictive ACL conditions, assuming you are using the right network name) you would have:
Make the changes to to include your System ACLs this time eg.
/**
* Sample access control list.
*/
rule SystemACL {
description: "System ACL to permit all access"
participant: "org.hyperledger.composer.system.Participant"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
rule NetworkAdminUser {
description: "Grant business network administrators full access to user resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "**"
action: ALLOW
}
rule NetworkAdminSystem {
description: "Grant business network administrators full access to system resources"
participant: "org.hyperledger.composer.system.NetworkAdmin"
operation: ALL
resource: "org.hyperledger.composer.system.**"
action: ALLOW
}
Update the "version" field in your existing package.json in your Business Network project directory (ie need to change it next increment - eg. update the version property from 0.0.1 to 0.0.2.)
From the same directory, run the following command:
composer archive create --sourceType dir --sourceName . -a a3-policy-network#0.0.2.bna
Now install the new business network code firstly:
composer network install --card PeerAdmin#hlfv1 --archiveFile a3-policy-network#0.0.2.bna
Then perform the requisite upgrade step (single '-' for short form of the parameter):
composer network upgrade -c PeerAdmin#hlfv1 -n a3-policy-network -V 0.0.2
After a few seconds, ping the network again to see ACL changes are now in effect:
composer network ping -c a3-policy-network

Google_auth JSON key with Heroku config var?

To make a server-server interact with a Google API in development I need to put my service-account JSON key in the root of myapp, set
ENV["GOOGLE_APPLICATION_CREDENTIALS"] = "api-test-key.json"
and all is good.
But in production on Heroku there are config vars and the google_auth credentials_loader.rb insists on a file.
I managed to put the JSON's contents in a heroku config var nicely and can get it by calling
puts ENV["GOOGLE_APPLICATION_CREDENTIALS"]
What to do?
There is this question where they figured out a workaround but that is for oauth2 not for service-account type JSON:
How to upload a json file with secret keys to Heroku
We config our GoogleAPI credentials via the application.yml file ... found in the root/config/application.yml file.
In it we have;
AUTH_URI: https://accounts.google.com/o/oauth2/auth
CLIENT_SECRET: xxxxxxx
TOKEN_URI: https://accounts.google.com/o/oauth2/token
CLIENT_EMAIL: xxxx
REDIRECT_URIS: http://localhost:3000/signin/connect
CLIENT_X509_CERT_URL: https://www.googleapis.com/robot/v1/metadata/x509/901506026811-q0am03i585627ptu5r38o7cpkt8pk98l#developer.gserviceaccount.com
CLIENT_ID: xxx
AUTH_PROVIDER_X509_CERT_URL: https://www.googleapis.com/oauth2/v1/certs
JAVASCRIPT_ORIGINS: http://localhost:3000
PLUS_LOGIN_SCOPE: https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/drive https://www.googleapis.com/auth/plus.circles.read
You could maybe load in your config settings here?

TC7 (20939) : upgrade : mercurial : http auth : Test Connection Succeeds... but build checks fail (http auth)

Have been using EAP 7 for a couple of months, this is the 2nd upgrade.
Upgraded to build 20939 today and now get errors when builds are trying to check mercurial for changes (VCS problem: FOO Edit this VCS root>>). If I edit the VCS Root and click Test Connection it succeeds. How do I go about debugging this issue?
Have tried re-saving the vcs root. I deleted and recreated the vcs root on one project and get the same result.
The recent entries in the teamcity-vcs log don't have domain\user:password, should they?
I now have both the teamcity and buildagent services running under my AD account. I don't remember what account the teamcity service was using before the upgrade (is that logged somewhere?).
If the vcs root is configured with an 'https://' and has user/password why don't I see the credentials in the log message (see above post)?
My user directory contains mercurial.ini / ssl cert (and was working pre-upgrade).
TeamCity hosted on Windows2k8, mercurial repo, using Active Directory credentials for authentication.
teamcity service is running as Local System
buildagent running as AD account (for builds that deploy to other machines)
newest errors:
[2012-01-11 17:12:39,578] WARN [cutor 4 {id=29}] - jetbrains.buildServer.VCS - Error while loading changes for root mercurial: https://mycompany.com/myproject {instance id=29, parent id=8}, cause: 'cmd /c hg pull https://mycompany.com/MyProject' command failed.
stderr: abort: http authorization required
older errors:
[2012-01-10 16:38:02,791] INFO [TeamCity Agent ] - jetbrains.buildServer.VCS - Patch applied for agent=computer {id=1, host=127.0.0.1:9090}, buildType=Project :: MVC3 {id=bt12}, root=mercurial: https://mycompany/myproject {instance id=12, parent id=1}, version=3775:7fc0ae5029e6
[2012-01-11 10:30:36,277] INFO [_Server_StartUp] - jetbrains.buildServer.VCS - Server-wide hg path is not set, will use path from the VCS root settings
The problem persisted after a complete uninstall/re-install.
In the VCS Root definition... I left the user/password fields blank and encoded the user:password into the 'Pull changes from' string (just like you'd do on the command-line.
https://domain\user:password#hg.mycompany.com/Repo
To sorta clean up the plaintext password I created a project level property 'MyPassword' (type password) and used it in the connection string like this:
https://domain\user:%MyPassword%#hg.mycompany.com/Repo
Still not great but I'm up and running and the password is not viewable by causal users.