This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!
Please refer to the link above to get access to our updated API documentation and examples.
| #! /bin/sh | |
| # Init. script for phantomjs, based on Ubuntu 12.04 skeleton. | |
| # Author: Anthony Lapenna <[email protected]> | |
| 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 |
| #!/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 |
| #!/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 |
| 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 |
| #!/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 |
| #!/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) |
This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!
Please refer to the link above to get access to our updated API documentation and examples.
| 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 |
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:
This file aims to explain how to deploy Portainer inside a compose file with the admin password already set.
For this example, we'll use the password superpassword.
Use the following command to generate a hash for the password: