No environment variables in OpenShift - openshift

I have created a new OpenShift account for a new application I'm developing.
I have added a MongoDB cartridge for the database, and a Tomcat cartridge for the Java web application.
I now need to connect to the database from my Java web app, but I miss two authentication details:
$OPENSHIFT_MONGODB_DB_HOST
$OPENSHIFT_MONGODB_DB_PORT
As far as I know, I have to type rhc env list -a the_name_of_my_app in the console, but my application seems to have no environment variables set.
What can I do?

Apparently, the default enironment variables are visible only via ssh.
In order to see them, you have to type rhc ssh <appid-as-seen-on-openshift-console> followeb by env.

you can see environment variables by doing ssh to openshift. Also you can use openshift port forwarding feature to setup a connection locally to your database.
Openshift blog link for port forwarding

Related

How to securely connect to a database in Next.js app (using Prisma and MySQL) deployed to Vercel (serverless)

My MySQL database on DigitalOcean is locked down to only be accessible via local connection.
I'd strongly prefer to keep it secure like that (i.e. not to open it up).
I'm used to using SSH tunnels to connect to it (such as ssh -L 3306:localhost:3306 -i ~/.ssh/id_rsa myusername#myhost).
Now that I'm deploying a Next.js app (with Prisma) to Vercel, I'm trying to figure out the appropriate DATABASE_URL environment variable.
How can I set the DATABASE_URL environment variable (or whatever other relevant setting) such that my Next.js backend is able to securely connect to my remote database that is only open to local connections?
I couldn't tell from the docs.

Redhat Openshift 4 - Not able to make mysql connection from php pod to mysql pod

I am user of Openshift online and OKD. I am facing similar issue in both places. Please have a look.
I have created a project.
I have launched php in Developer's Catalog option. With other details, I entered my project's git url, project is cloned successfully. Now it needs to connect to mysql database only.
In Pods, I deployed mysql image from 'Deploy Image' option. It is launched successfully.
When I make mysql connection from php pod to mysql pod, it does not connect, connection time out.
How should I make connection?
Note :
I do not have datastore option to launch mysql from developer's catalog in openshift online, that's why I am launching mysql image from deploy image.
As you mentioned you are using Openshift Online and OKD and you are facing the issue at both places.
You can not create mysql from development store because currently, the OpenShift Online catalog does not provide MySQL template via the web interface directly, but you can deploy the MySQL template using the oc CLI instead. The database deployment is simplified when using templates.
Once logged in with the oc CLI, running
oc new-app -L
will list all of the templates that we were used to seeing in the web console, including the mysql-persistent. Then, you can specify all the template parameters via the oc CLI, e.g.:
oc new-app mysql-persistent -p MYSQL_USER=<desired_DB_username> -p MYSQL_PASSWORD=<mysql_password> -p MYSQL_DATABASE=<desired_database_name>
If you'd like to see all the supported template parameters, you can use
oc process <template_name> --parameters -n openshift
or, for a more detailed output,
oc describe template <template_name> -n openshift
Once the app is launched successfully, you can find this app's hostname in services and connect to it from your php pod after defining host name in php configuration file.

How to start the tutorials-IoT.Sensors services to start in linux instance in FIWARE Lab

I recently deployed an instance of Ubuntu 16.04 on FIWARE Lab and accessed it using putty, I downloaded docker & docker-compose, I successfully installed fiware-orion & mongo-db as I followed the tutorial, I tried to follow the iot sensor tutorial but whenever I try to start the service it keeps stucking in this infinte loop -> Context Broker HTTP state : 000 (waiting for 200).
Any suggestions?
Details
region:crete
image: ubuntu 16.04
putty infinite loop
The problem was that the docker-compose did not include Orion (and MongoDB) instance which are required dependencies for this tutorial. We have updated the corresponding docker-compose file in order to include both dependencies and now it is working properly. Tips: do not forget to open the corresponding port (3000) in the security and assign a floating IP to the virtual machine to access to the /device/monitor (do not use localhost for accessing it).

Can I deploy mysql in the openshift and access from the outter

I create a diy Appliation and add a mysql cartridge and bind it to the port 8080.Is it possible to access outside the network through domain? I have a little idea about the routing
system.
I am not very sure what you want here. But you can use putty in your local machine to connect to Openshift mysql.
Thank you
You can use port forwarding using the 'rhc' command line or using the OpenShift Tooling in JBoss Tools. In both case, you'll have a set of local sockets to connect to, and it will forward commands to the remote 3306 port on your OpenShift gear, so you can run MySQL/SQL commands on your database.

Configuring Glassfish without admin console gui

I have installed Glassfish application server Openshift cloud servers. I can only use :8080 port because of Openshift restrictions. It won't let me run admin console on :4848 port and I will somehow configure datasource, file realm and security realm manually from configuration files.
a-) Is it possible to do configuration without the admin console?
b-) Can admin console run on :8080 port along with applications?
Note: It is not possible to allocate any port for admin console Openshift won't let me do it.
Thanks
a) You can configure Glassfish with the asadmin tool
b) You can change the port for the admin console in glassfish/domains/[yourdomain]/config/domain.xml: search for
<network-listener port="4848" protocol="admin-listener" transport="tcp" name="admin-listener" thread-pool="admin-thread-pool"></network-listener>
But I doubt it is possible to use port 8080 for admin gui AND other applications.