Browse Source

first import

rc1
Valentin Lab 6 years ago
commit
c9f512bc4f
  1. 47
      bin/check-compose-ovh-credentials
  2. 19
      bin/update

47
bin/check-compose-ovh-credentials

@ -0,0 +1,47 @@
#!/usr/bin/env python
## -*- encoding: utf-8 -*-
import ovh
import yaml
import sys
import os.path
# Instantiate. Visit https://api.ovh.com/createToken/index.cgi?GET=/me
# to get your credentials
def main(argv):
if len(argv) == 1:
sys.stderr.write("Error: provide a YAML compose file as first argument.\n")
exit(1)
if not os.path.exists(argv[1]):
sys.stderr.write("Error: file '%s' not found.\n" % argv[0])
sys.stderr.write("Error: provide a YAML compose file as first argument.\n")
exit(1)
try:
with open(sys.argv[1], 'r') as stream:
yml = yaml.load(stream)
except Exception:
sys.stderr.write("Error: provide a YAML compose file as first argument.\n")
exit(1)
ovh_cfg = yml["letsencrypt"]["options"]["env"]["ovh"]
client = ovh.Client(
endpoint=ovh_cfg["entrypoint"],
application_key=ovh_cfg["application"]["key"],
application_secret=ovh_cfg["application"]["secret"],
consumer_key=ovh_cfg["consumer_key"],
)
# Print nice welcome message
print "Welcome", client.get('/me')['firstname']
domains = client.get('/domain/zone')
print "Domains:"
for domain in domains:
print " - %s" % domain
if __name__ == "__main__":
main(sys.argv)

19
bin/update

@ -0,0 +1,19 @@
#!/bin/bash
. /etc/shlib
include common
include pretty
Wrap -d "Updating 0k-charms" <<EOF || exit 1
cd /opt/apps/0k-charms
git pull -r
EOF
charm --debug apply docker-host
## there seem to be an error now within compose when trying to download let's encrypt image.
Wrap -d "Updating some docker images" <<EOF || exit 1
docker pull docker.0k.io/letsencrypt
EOF
Loading…
Cancel
Save