Openshift MYSQL environment variables not set - mysql

all my MySQL environment variables result in an empty string such as
echo getenv('OPENSHIFT_MYSQL_DB_URL');
echo getenv('OPENSHIFT_MYSQL_DB_HOST');
however the others such as
echo getenv('OPENSHIFT_APP_NAME');
echo getenv('OPENSHIFT_REPO_DIR');
work perfectlly fine. Any ideas what i am doing wrong?

I had the same issue, and tried creating and recreating Applications multiple times without success
The solution was to use Git to push the code to Openshift (at least one time), if you only use sFTP to push the code, those variables will not be accessible

You can just use the rhc app stop & rhc app start commands to restart your application and the environment variables will then be provided to your application. Make sure that you don't just use the rhc app restart command, as it doesn't not usually work, think of it as an apachectl stop/start vs apachectl reload.

Related

apt-get: command not found in mysql docker CLI

as a first... yes...yes I know there are 1000 questions and solutions to this. But unfortunately none of them helps me.
Let's get to the problem:
I have a Docker container running on which MySQL is configured. Now I would like to change the bind address from 127.0.0.1 to 0.0.0.0. Unfortunately I can't open my.cnf because I don't have nano, vim installed. With apk, yum, vim, apt-get and so on I get that:
apt-get: command not found
apk: command not found
...
Could someone of you maybe help me out with my little problem?
best thanks and greetings
The default for MySQL docker image has been changed to Oracle based Linux distribution. In this distribution, the default package manager is yum. If for whatever reason you still want to use apt, pull Debian image explicitly. Something like mysql:8-debian.
See this issue for more detail.
You could do a docker cp to copy the file out of the container, edit it, and then docker cp it back in again. This may be fine if you need to do this for troubleshooting, but you probably want to look at fixing this in your deployment process. You should be able to destroy and re-create the docker container without having to manually fix configurations. This should be handled in your Dockerfile, or perhaps copying the correct configuration file in in your docker compose file.

Using socat to access X remotely

I have a remote server on which I want to launch some gui applications inside a network namespace I have already setup. I am using socat to forward the x session.
socat exec:'ssh {REMOTE_HOST} rm -rf /tmp/.X11-unix/X1; socat -d -d -d -d unix-l\:/tmp/.X11-unix/X1111 -' unix:/tmp/.X11-unix/X0
However, if I try to launch an application like eog
DISPLAY=:1111 eog
It fails with the following message:
I No protocol specified
** (eog:9498): WARNING **: Could not open X display
Cannot open display:
Run 'eog --help' to see a full list of available command line options.
And socat exits immediately afters.
Well, it took a day but I figured a way to do it.
I ended up using Xpra to start an X-server at the remote server and attached to it in my local machine.
The socat approach worked too after running xhost + locally and adding the fork flag in the socat invocation at the remote server . However, it never worked consistently (There was as much chance the application to hang during launch as not). And it never worked with more complex applications like firefox. Stracing the apps pointed towards the applications hanging when trying to use dbus.

Changing Haproxy configuration on openshift

I have a scalable Python 2.7 app on OpenShift and I'm getting this 503 error.
I checked some answers that might work but they say to rhc into the app and change the Haproxy configurations, but I don't have a clue on how to do it.
Can someone help me please?
1) Install rhc: https://developers.openshift.com/en/managing-client-tools.html and read https://blog.openshift.com/how-haproxy-scales-openshift-apps/
2) Run $ rhc setup for the initial configuration of the tool and check https://developers.openshift.com/en/managing-log-files.html#accessing-logs-via-ssh for viewing haproxy logs
3) Run rhc ssh --app yourapp, once inside, cd haproxy/conf and change your haproxy.cfg appropriately
I edited haproxy.cfg:
option httpchk OPTIONS * HTTP/1.1\r\nHost:\ {{ my app link }}
It’s working now.

Unable to delete openshift application

I installed a PHP application on one of my gears in Openshift. It is a git clone from https://github.com/ThinkUpLLC/ThinkUp/tree/v2.0-beta.10. Something went wrong with the application and hence I would like to delete this application now. However I get an error as "Unable to perform action on app object. Another operation is already running." while trying to delete the application using rhc command tool. I have already tried using rhc app-force-stop, however it did not make any difference.
Sounds a bit like this bug - https://bugzilla.redhat.com/show_bug.cgi?id=997008. There seems to be no solution/workaround though.
Have you tried deleting the application via the web console?
You can try this command, this will kill all the background processes associated with the app.
pbrun /usr/sbin/oo-admin-ctl-app -l svc-<domain-id> -c destroy -a <app-name> -n <domain-id>

Run a task before svn check-out

I would like to run a task (stop a running vm machine) before Jenkins starts the check-out.
The reason is: VM blocks access to some files I have to update via subversion.
Is this possible?
There are two plugins for controlling virtual machines, depending on whether you are using VirtualBox or VMWare.
I'm quite sure you can configure the pre-build step to be "Suspend" as shown in the images, at least for VMWare.
VMware Plugin
VirtualBox Plugin
Edit your project and set:
Configure M2 Extra Build Steps --> Execute shell --> Type in whatever you'd like to do. For example:
# Wipe the local repository before each build.
rm -rf $WORKSPACE/.repository
Have a look at How do I trigger another job from hudson as a pre-build step?. I think this has been asked before there.