Skip to content

Instantly share code, notes, and snippets.

View ncdc's full-sized avatar

Andy Goldstein ncdc

View GitHub Profile
a jenkins build will experience more downtime now than it did before with hot deploy
before:
git push -> jenkins builds in the bldr, jenkins rsyncs to upstream, hooks are executed, pretty much it (no stopping of anything)
now:
git push -> jenkins builds in the bldr, jenkins tells upstream to create a new deployment dir (now the live gear is dead b/c app-root/runtime/repo is a bad symlink), jenkins rsyncs upstream, hooks executed etc, symlink updated, now we're live again
October 14 10:42:14 INFO oo_spawn running /sbin/runuser -s /bin/sh 525c029f0f012eec22000081 -c "exec /usr/bin/runcon 'unconfined_u:system_r:opens
hift_t:s0:c0,c1001' /bin/sh -c \"tail -c 10240 /tmp/initial-build.log 2>&1\"": {:unsetenv_others=>false, :close_others=>true, :in=>"/dev/null", :
chdir=>"/var/lib/openshift/525c029f0f012eec22000081/", :out=>#<IO:fd 12>, :err=>#<IO:fd 8>}
October 14 10:42:14 INFO oo_spawn buffer(11/) Stopping Cron cartridge
Stopping PHP cartridge
Syntax error on line 2 of /var/lib/openshift/525c029f0f012eec22000081/php/configuration/etc/conf.d/openshift.conf:
DocumentRoot must be a directory
httpd (no pid file) not running
Stopping MySQL cartridge
Building git ref 'master', commit 796b749
@ncdc
ncdc / gist:6997731
Last active December 25, 2015 15:19
build_dependency_dirs:
-
link: ~/.m2
target: $OPENSHIFT_BUILD_DEPENDENCIES_DIR/jbossas/.m2
[root@ip-10-170-21-94 p]# rhc deploy master
Deployment of git ref 'master' in progress for application p ...
Executing Jenkins build.
You can track your build at https://jenkins-agoldste.dev.rhcloud.com/job/p-build
Waiting for build to schedule....
.
.
.
source $OPENSHIFT_CARTRIDGE_SDK_BASH
alias rsync="rsync --delete-after -az -e '$GIT_SSH'"
upstream_ssh="525ffd06f335d37c9d000011@p-${OPENSHIFT_NAMESPACE}.dev.rhcloud.com"
# Jenkins will have already cloned from git into $OPENSHIFT_HOMEDIR/app-root/runtime/repo
# need to preserve it so we can move it to the new deployment dir
mv $OPENSHIFT_HOMEDIR/app-root/runtime/repo $OPENSHIFT_HOMEDIR/app-root/runtime/repo.tmp
Builder gear created, before job starts building:
[root@ip-10-170-21-94 p2]# ls -l /var/lib/openshift/p2bldr-agoldste/app-root/runtime/
total 12
lrwxrwxrwx. 1 52603b5bf335d3ecbb000063 52603b5bf335d3ecbb000063 102 Oct 17 15:32 build-dependencies -> /var/lib/openshift/52603b5bf335d3ecbb000063/app-deployments/2013-10-17_15-32-47.307/build-dependencies
lrwxrwxrwx. 1 52603b5bf335d3ecbb000063 52603b5bf335d3ecbb000063 7 Oct 17 15:32 data -> ../data
lrwxrwxrwx. 1 52603b5bf335d3ecbb000063 52603b5bf335d3ecbb000063 96 Oct 17 15:32 dependencies -> /var/lib/openshift/52603b5bf335d3ecbb000063/app-deployments/2013-10-17_15-32-47.307/dependencies
lrwxrwxrwx. 1 52603b5bf335d3ecbb000063 52603b5bf335d3ecbb000063 88 Oct 17 15:32 repo -> /var/lib/openshift/52603b5bf335d3ecbb000063/app-deployments/2013-10-17_15-32-47.307/repo
After job starts building:
source $OPENSHIFT_CARTRIDGE_SDK_BASH
alias rsync="rsync --delete-after -az -e '$GIT_SSH'"
upstream_ssh="52602dd0f335d3ecbb000001@p2-${OPENSHIFT_NAMESPACE}.dev.rhcloud.com"
# Create a new deployment dir
local_deployment_dir=`gear create-deployment-dir`
rmdir $OPENSHIFT_HOMEDIR/app-deployments/$local_deployment_dir/repo
ln -nsf $OPENSHIFT_HOMEDIR/app-root/runtime/repo $OPENSHIFT_HOMEDIR/app-deployments/$local_deployment_dir/repo
Set keep deployments to 2
Deploy (success), dir=1, id=1, activations=[1]
Deploy (fail), dir=2, no id, activations=[], and because keep > 1, we restart the app since id=1 is still around
Deploy (fail), dir=3, no id, activations=[], ends up deleting dir=1/id=1 because a dir with no activations (dir=2) is seen as newer than a dir with activations(dir=1)
[ps-agoldste.dev.rhcloud.com 52618786cf0e37413300012b]\> gear restart --all
Cart to restart?
1. php-5.3
2. haproxy-1.4
? 1
Restarting PHP cartridge
[ps-agoldste.dev.rhcloud.com 52618786cf0e37413300012b]\> exit
VirtualMachine vm = VirtualMachine.attach("7851");
String javaHome = vm.getSystemProperties().getProperty("java.home");
String agentJar = javaHome + File.separator + "lib" + File.separator + "management-agent.jar";
vm.loadAgent(agentJar, "com.sun.management.jmxremote");
String localConnectorAddress = vm.getAgentProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
if (localConnectorAddress == null) {
// Check system properties
localConnectorAddress = vm.getSystemProperties().getProperty("com.sun.management.jmxremote.localConnectorAddress");
}
vm.detach();