Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
https://bit.ly/IqT6zt

Anthony Lapenna deviantony

🤖
https://bit.ly/IqT6zt
View GitHub Profile
@deviantony
deviantony / phantomjs
Last active Jan 4, 2018 — forked from wbotelhos/phantomjs_intaller.sh
Installer script to setup phantomjs 1.9.7, it will remove any previous setup. Contains also the init script to manage phantomjs as a system service and the default configuration file. Tested on Ubuntu 12.04.
View phantomjs
#! /bin/sh
# Init. script for phantomjs, based on Ubuntu 12.04 skeleton.
# Author: Anthony Lapenna <lapenna.anthony@gmail.com>
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Phantomjs service"
NAME=phantomjs
DAEMON=/usr/bin/$NAME
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
@deviantony
deviantony / vsphere_info.py
Last active Sep 7, 2022
VMWare Vsphere info in Python using pyvmomi
View vsphere_info.py
#!/usr/bin/env python
import pyVmomi
import argparse
import atexit
import itertools
from pyVmomi import vim, vmodl
from pyVim.connect import SmartConnect, Disconnect
import humanize
@deviantony
deviantony / gist:ddb93425dc6f011c4d8b
Created Sep 13, 2015
SH entrypoint for docker-compose to manage dependency startup.
View gist:ddb93425dc6f011c4d8b
#!/usr/bin/env sh
# Wait for a HTTP service to be OK (return code 200) before trying to start another service.
echo "Stalling for SERVICE"
while true; do
status=$(curl --write-out %{http_code} --silent --output /dev/null http://service.domain/endpoint)
echo "Status: ${status}"
if [ "${status}" == "200" ]; then
break
else
@deviantony
deviantony / valigator.conf
Last active Dec 21, 2015
Valigator upstart script
View valigator.conf
description "Valigator tool"
author "Anthony Lapenna"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /usr/local/bin/valigator --conf /path/to/valigator.yml
@deviantony
deviantony / local-persist-install-nosudo.sh
Last active Jun 21, 2016
Installation of the local-persist volume driver for docker without sudo
View local-persist-install-nosudo.sh
#!/usr/bin/env bash
set -e
VERSION="v1.2.1"
# uname -s, uname -m
# Deb 32: Linux i686
# Ubuntu 64: Linux x86_64
# FreeBSD: FreeBSD amd64
@deviantony
deviantony / install-latest-compose.sh
Last active Sep 27, 2022
Install latest version of Docker Compose
View install-latest-compose.sh
#!/bin/bash
## THIS IS THE OLD WAY
## Nowadays, simply follow the Compose installation instructions in the official documentation:
## https://docs.docker.com/compose/install/
# get latest docker compose released tag
COMPOSE_VERSION=$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep 'tag_name' | cut -d\" -f4)
@deviantony
deviantony / README.md
Last active Oct 2, 2022
Portainer HTTP API by example
View README.md

DEPRECATION NOTICE

This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!

THE FOLLOWING DOCUMENTATION IS DEPRECATED

Please refer to the link above to get access to our updated API documentation and examples.

@deviantony
deviantony / docker-compose.yml
Created Sep 5, 2017
Docker Swarm cluster setup with Docker in Docker
View docker-compose.yml
version: "2"
services:
portainer:
image: portainer/portainer:latest
container_name: "portainer-app"
command: -H unix:///var/run/docker.sock
networks:
- portainer
volumes:
- /tmp/manager_run/docker.sock:/var/run/docker.sock
@deviantony
deviantony / AGENT_CLUSTER.md
Last active May 4, 2022
Swarm aggregation feature discussion
View AGENT_CLUSTER.md

Cluster of agents

This implementation rely on the fact that the agent is able to auto-discover other agents. Deployed as a global service inside a Swarm cluster, each agent automatically discover the other agents in the cluster and register them.

Portainer can then be plugged on any of these agents (either by using DNS-SRV records ensure high-availability or using the URL to a specific agent). To do so, a user would just need to create a new endpoint and add the IP:PORT to one of the agents in the cluster (or use the Swarm service name to be able to use DNS-SRV records).

The agent would be responsible for the following:

  • Aggregate the data of multiple nodes (list the containers available in the cluster for example)
  • Redirect requests to specific nodes in the cluster (inspect a container on a specific node or create a new secret via a cluster manager for example)
@deviantony
deviantony / README.md
Created Mar 8, 2018
Portainer admin password in a docker-compose environment
View README.md

Portainer compose deployment with admin password preset

This file aims to explain how to deploy Portainer inside a compose file with the admin password already set.

Generate the admin password

For this example, we'll use the password superpassword.

Use the following command to generate a hash for the password: