Skip to content

Instantly share code, notes, and snippets.

@jamshid
jamshid / docker-compose.yml
Last active November 12, 2019 04:35
Sample docker-compose.yml voting app to test the weave network plugin with Docker Swarm
# Copied from https://github.com/dockersamples/example-voting-app, to test the
# "weave" Docker Swarm network plugin https://www.weave.works/docs/net/latest/install/plugin/plugin-v2/
# on a two node network (docker-server-manager and docker-server-worker).
# While both provide a cross-server container network, weave supports multicast and encryption.
#
# The sample app deploys fine with the standard "overlay" network:
#
# docker stack deploy -c ./docker-compose.yml voteapp
#
# The below curls work as expected -- in the container network the service names resolve
/**
* Can download libpam4j and JNA jars from:
* http://mvnrepository.com/artifact/org.kohsuke/libpam4j
* https://github.com/twall/jna
* https://github.com/matthiasblaesing/libpam4j/commits/gc_and_threadsave
*
* SETUP: useradd zuser1 ; echo zuser1:password | chpasswd ; useradd zuser2 ; echo zuser2:password | chpasswd
* BUILD 1.8: javac -classpath ./jna-4.0.0.jar:./libpam4j-1.8.jar:. PAMTest.java
* BUILD 1.9X: javac -classpath ./jna-4.1.0.jar:./libpam4j-1.9X.jar:. PAMTest.java
* FAILS: sudo java -classpath ./jna-4.0.0.jar:./libpam4j-1.8.jar:. PAMTest zuser1:password zuser2:password
/**
* If you get a strange JVM crash on CentOS 6 in code related to JNA and PAM,
* try uninstalling this RedHat package related to fingerprint scanners:
*
* sudo yum remove fprintd-pam
*
* Run this program with 100-500 threads -- the jvm usually crashes with
* a stack like below (from hs_error.log ). Probably related to issues like:
* https://bugzilla.redhat.com/show_bug.cgi?id=1010844.
* Probably also affected by machine resource limits.
@jamshid
jamshid / install-python2.7-centos6
Last active February 7, 2016 05:37
Is this really the best way to install python2.7 on CentOS?
yum install -y bzip2-devel zlib zlib-devel openssl openssl-devel
cd /opt
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall
cd /tmp
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
@jamshid
jamshid / update-hosts.sh
Last active June 18, 2023 18:05
Docker environment hack, to put the names of running containers in /etc/hosts
#!/bin/bash
# An alternative to "links", run this script after starting or stopping any
# container. It's a hack to update the host machine (vagrant) /etc/hosts with
# the current active docker containers and tell dnsmasq to refresh.
#
# Then start each machine with "-dns ${DOCKER_HOST_IP}", e.g.
# $ docker run -d -name mycontainer1 -dns 10.0.3.1 MYPRODUCT
# You can't seem to set the DNS during "docker build".
#
# Diagnostic command to run in host or while logged into containers: