From nobody Mon Sep 16 19:23:55 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=patchew-devel-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=patchew-devel-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1540949961414561.5631484701179; Tue, 30 Oct 2018 18:39:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42B0585550; Wed, 31 Oct 2018 01:39:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 326C686FD5; Wed, 31 Oct 2018 01:39:20 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 270F31808841; Wed, 31 Oct 2018 01:39:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w9V1T5uY012170 for ; Tue, 30 Oct 2018 21:29:05 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8465861B92; Wed, 31 Oct 2018 01:29:05 +0000 (UTC) Received: from magic.redhat.com (ovpn-12-37.pek2.redhat.com [10.72.12.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id D36B761B7B; Wed, 31 Oct 2018 01:29:03 +0000 (UTC) From: Fam Zheng To: patchew-devel@redhat.com Date: Wed, 31 Oct 2018 09:28:52 +0800 Message-Id: <20181031012856.30125-3-famz@redhat.com> In-Reply-To: <20181031012856.30125-1-famz@redhat.com> References: <20181031012856.30125-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: patchew-devel@redhat.com Subject: [Patchew-devel] [PATCH 2/6] deploy: Deploy a Dockerized postgres DB X-BeenThere: patchew-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Patchew development and discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: patchew-devel-bounces@redhat.com Errors-To: patchew-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 31 Oct 2018 01:39:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- scripts/deploy | 10 +++++++++- scripts/dockerfiles/db.docker | 6 ++++++ scripts/playbooks/deploy-db.yml | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 scripts/dockerfiles/db.docker create mode 100644 scripts/playbooks/deploy-db.yml diff --git a/scripts/deploy b/scripts/deploy index 0fc61ff..1953e9b 100755 --- a/scripts/deploy +++ b/scripts/deploy @@ -17,11 +17,13 @@ def parse_args(): parser =3D argparse.ArgumentParser() parser.add_argument("--server", "-s", dest=3D"web_server", help=3D"Web server host address") + parser.add_argument("--db", "-d", dest=3D"db_server", + help=3D"Database host address") parser.add_argument("--tester", "-t", nargs=3D"*", dest=3D"testers", help=3D"Tester host address") parser.add_argument("--importer", "-i", nargs=3D"?", help=3D"Importer host address") - parser.add_argument("--debug", "-d", action=3D"store_true", + parser.add_argument("--debug", "-D", action=3D"store_true", help=3D"Enable debug output") return parser.parse_known_args() =20 @@ -31,12 +33,16 @@ def generate_inventory_file(args): [servers] %s =20 +[db] +%s + [importers] %s =20 [testers] %s""" \ % (args.web_server or "", + args.db_server or "", args.importer or "", "\n".join(args.testers or []))) f.flush() @@ -50,6 +56,8 @@ def main(): playbooks =3D [] if args.web_server: playbooks.append("deploy-servers.yml") + if args.db_server: + playbooks.append("deploy-db.yml") if args.testers: playbooks.append("deploy-testers.yml") if args.importer: diff --git a/scripts/dockerfiles/db.docker b/scripts/dockerfiles/db.docker new file mode 100644 index 0000000..80a34e5 --- /dev/null +++ b/scripts/dockerfiles/db.docker @@ -0,0 +1,6 @@ +FROM postgres:11 +EXPOSE 5432 +ENV POSTGRES_USER patchew +ENV POSTGRES_PASSWORD patchew +ENV POSTGRES_DB patchew +ENV PGDATA /data/patchew/db diff --git a/scripts/playbooks/deploy-db.yml b/scripts/playbooks/deploy-db.= yml new file mode 100644 index 0000000..2b69995 --- /dev/null +++ b/scripts/playbooks/deploy-db.yml @@ -0,0 +1,18 @@ +- hosts: db + vars_prompt: + - name: instance_name + prompt: "Instance name of the patchew postgres db" + default: patchew-server-db + private: no + vars: + base_dir: "/data/{{ instance_name }}" + src_dir: "{{ base_dir }}/src" + data_dir: "{{ base_dir }}/data" + tasks: + - name: Create data dir + file: + path: "{{ data_dir }}" + state: directory + - import_tasks: tasks/docker-deploy.yml + vars: + instance_role: db --=20 2.17.2 _______________________________________________ Patchew-devel mailing list Patchew-devel@redhat.com https://www.redhat.com/mailman/listinfo/patchew-devel