Changing Haproxy configuration on openshift - 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.

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.

404 Not Found Error for PHPmyAdmin on DigitalOcean droplet following linking of existing domain name

https://www.digitalocean.com/community/questions/how-to-access-a-java-web-application-by-a-domain-name-using-tomcat-8
After following all the steps and the related guides linked to in the post above, I was able to access my Java Spring application using "mywebsite.com:8080/appname".
Unfortunately, unlike before, I am unable to reach my phpmyadmin installation using either "mywebsite.com/phpmyadmin" or "droplet-ip/phpmyadmin" (which worked fine previously) and instead I get a 404 error saying phpmyadmin directory does not exist.
Additionally, even after following all the tips in said post I'm also unable to reach my app using just "mywebsite.com" and still have to add the additional ":8080/appname", contrary to what the post suggests.
I have tried sudo dpkg-reconfigure phpmyadmin and have been sure to select apache2 during the installation, but still have no success. I can still access my TomCat manager, and the apache home page when using "mywebsite.com" or "droplet-ip".
If any further information is needed, please let me know.
For Ubuntu 15.04 and 16.04
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo service apache2 reload

PhpStorm & Xdebug - cant get to work debugger with CLI script

This is my first post here, I post because after reading through X articles googling can't get PhpStorm, Xdebug work with CLI scripts.
Already tried to follow advices from:
PHPStorm + XDebug Setup Walkthrough
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
PHPStorm + XDebug + Vagrant
and few blogs that I've found online, but still nothing...
I had it working, but after destroy vagrant recently and now can't fully restore this feature.
SETUP:
I'm running Symfony project on Vagrant.
Debugging of "webpages" on my server works just perfectly.
When I try debug CLI Command I prequisite it with:
export XDEBUG_CONFIG="XDEBUG_SESSION=1"
export PHP_IDE_CONFIG="serverName=vagrant"
XDEBUG.INI (on Vagrant):
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant)
xdebug.remote_port=9000
xdebug.max_nesting_level=2500
xdebug.remote_handler=dbgp
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.idekey="PHPSTORM"
Any help much appreciated. Digged through X articles on web but in my eyes all configurations look ok, no idea what to do...
Set xdebug.remote_connect_back to be 0.
This option prevents you from using right IP address when you are doing Remote CLI debugging. Since it's a CLI debug, the IP will always be local (vagrant machine) while you need another one.
This option works OK when debugging over browser as request comes from your "real" computer. But when doing CLI debug .. request will be local to Vagrant machine.
When this option is set to 1 (as it is done now) it ignores the setting from #2 below.
xdebug.remote_host=192.168.0.133 (ip I get from ifconfig -a on Vagrant) -- this should be an IP of your computer where PhpStorm is running as seen from Vagrant machine.
Combination of those 2 above will do the job for you.

Alternative ways to deploy code to Openshift

I am trying to setup Travis CI to deploy my repository to Openshift on a successful build. Is there a way to deploy a repository besides using Git?
Git is the official mechanism for how your code is update, however depending on the type of application that you are deploying you may not need to deploy your entire code base.
For example Java application (war, ear, etc) can be deployed to JBoss or Tomcat servers, by simply taking the built application and checking it into the OpenShift git repositories, webapps or deploy directories.
An alternative to this (and it will be unsupported), is to scp your application to the gear using the SSH key. However any time the application is moved or updated (with git) this content stands a good chance of getting deleted(cleaned), by the gear.
We're working on direct binary deploys ("push") and "pull" style deploys (Openshift downloads a binary for you. The design/process is described here:
https://github.com/openshift/openshift-pep/blob/master/openshift-pep-006-deploy.md
You can do a SCP to the app-root/dependencies/jbossews/webapps directory direcly. I was able to do that successfully and have the app working. Here is the link
Here is the code which I had in the after_success blck
after_success:
- sudo apt-get -y install sshpass
- openssl aes-256-cbc -K $encrypted_8544f7cb7a3c_key -iv $encrypted_8544f7cb7a3c_iv
-in id_rsa.enc -out ~/id_rsa_dpl -d
- chmod 600 ~/id_rsa_dpl
- sshpass scp -i ~/id_rsa_dpl webapps/ROOT.war $DEPLOY_HOST:$DEPLOY_PATH
Hope this helps

How to setup supervisord on Elastic Beanstalk?

I am migrating from DotCloud to Elastic Beanstalk.
Using DotCloud, they clearly explained how to set up Python Worker, and how to use supervisord.
Moving to Elastic Beanstalk, I am lost on how I could do that.
I have a script myworker.py and want to make sure it is always running. How?
Elastic Beanstalk is just a stack configuration tools over EC2, ELB and autoscaling.
One approach you can use, is create your own AMI, but since October last year, there is another approach that probably will be more suitable for your needs: ebextensions.
.ebextension is just a directory in your application, that get's detected once your application has been loaded by AWS.
Here is the full documentation: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
With Amazon Linux 2 you need to use the .platform folder to supply elastic beanstalk with installation scripts.
We recommend using platform hooks to run custom code on your environment instances. You can still use commands and container commands in .ebextensions configuration files, but they aren't as easy to work with. For example, writing command scripts inside a YAML file can be cumbersome and difficult to test.
So you should add a prebuild hook (example) into a .platform folder to install supervisor and a postdeploy hook (example) to restart supervisor after each deployment.
There is an ini file (example) used in the script; which is made for laravel specific.
Make sure that the .sh files from the .platform folder are executable before deploying your project:
$ chmod +x .platform/hooks/prebuild/*.sh
$ chmod +x .platform/hooks/postdeploy/*.sh