From a30dda5ce7819fc3463693eef7abf4344cc7216f Mon Sep 17 00:00:00 2001 From: Meutel Date: Fri, 27 Sep 2019 17:53:32 +0200 Subject: [PATCH] Ansible + fix default path --- .ansible/deploy-draft.yml | 5 ++--- .ansible/inventory | 4 ++++ .drone.yml | 35 ++++++++++++++--------------------- main.go | 4 ++-- 4 files changed, 22 insertions(+), 26 deletions(-) create mode 100644 .ansible/inventory diff --git a/.ansible/deploy-draft.yml b/.ansible/deploy-draft.yml index 9c3cab2..f04a6a1 100644 --- a/.ansible/deploy-draft.yml +++ b/.ansible/deploy-draft.yml @@ -14,8 +14,7 @@ traefik.frontend.rule: "Host:{{ draft_name }}.bouquins.www.meutel.net" networks: name: proxybackend - # TODO volumes - volumes_from: - - mydata + volumes: + - bouquins_draft:/root/data # vim:ft=ansible: diff --git a/.ansible/inventory b/.ansible/inventory new file mode 100644 index 0000000..ad8705e --- /dev/null +++ b/.ansible/inventory @@ -0,0 +1,4 @@ +ambrosia ansible_host=148.251.42.122 ansible_python_interpreter=/usr/bin/python3 ansible_user=drone + +[docker] +ambrosia diff --git a/.drone.yml b/.drone.yml index 43b0756..e9e405d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -45,7 +45,6 @@ steps: registry: reg.meutel.net repo: reg.meutel.net/go-bouquins tags: ${DRONE_BRANCH##feature/} - debug: true username: from_secret: registry_login password: @@ -54,32 +53,26 @@ steps: branch: - feature/* + - name: deploy-branch + image: plugins/ansible:1 + environment: + draft_name: ${DRONE_BRANCH##feature/} + settings: + playbook: .ansible/deploy-draft.yml + inventory: .ansible/inventory + private_key: + from_secret: drone_ssh_key + when: + branch: + - feature/* + trigger: event: - push - tag ---- -kind: pipeline -type: ssh -name: deploy - -server: - host: meutel.net - user: drone - ssh_key: - from_secret: drone_ssh_key - -steps: - - name: deploy-branch - commands: - - id - -depends_on: - - default - --- kind: signature -hmac: 2432bc54b5194625c455761323cb615cc117611ee9af4639f9b3463824f158fa +hmac: 7a0b174d395933fd3e9826391addd09db9272668e77291f78d23528b370c1cf4 ... diff --git a/main.go b/main.go index 77300f2..65ed0b2 100644 --- a/main.go +++ b/main.go @@ -32,13 +32,13 @@ func ReadConfig() (*bouquins.Conf, error) { } // default values if conf.CalibrePath == "" { - conf.CalibrePath = "." + conf.CalibrePath = "./data" } if conf.DbPath == "" { conf.DbPath = conf.CalibrePath + "/metadata.db" } if conf.UserDbPath == "" { - conf.UserDbPath = "./users.db" + conf.UserDbPath = "./data/users.db" } if conf.BindAddress == "" { conf.BindAddress = ":9000"