From 9d72acbb816c6040b608c63f18b8dbb169ceb2c3 Mon Sep 17 00:00:00 2001 From: Kristofer Hallin Date: Thu, 7 Apr 2022 14:12:06 +0200 Subject: Added PostgreSQL. --- docker/docker-compose.yaml | 15 +++++++ docker/postgres/Dockerfile | 5 +++ docker/postgres/schema.sql | 97 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 117 insertions(+) create mode 100644 docker/postgres/Dockerfile create mode 100644 docker/postgres/schema.sql diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 23a543b..ccd957d 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -34,7 +34,22 @@ services: source: couchdb-data target: /opt/couchdb/data + postgres: + build: ./postgres + volumes: + - type: volume + source: postgres-data + target: /var/lib/postgresql/data/ + environment: + - POSTGRES_USER + - POSTGRES_PASSWORD + - POSTGRES_DB + ports: + - 5432:5432 + volumes: couchdb-data: external: false + postgres-data: + external: false certs: diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile new file mode 100644 index 0000000..1699f02 --- /dev/null +++ b/docker/postgres/Dockerfile @@ -0,0 +1,5 @@ +FROM postgres:14 + +COPY schema.sql /docker-entrypoint-initdb.d/ + +EXPOSE 5432 diff --git a/docker/postgres/schema.sql b/docker/postgres/schema.sql new file mode 100644 index 0000000..38ff863 --- /dev/null +++ b/docker/postgres/schema.sql @@ -0,0 +1,97 @@ +-- +-- PostgreSQL database dump +-- + +-- Dumped from database version 14.2 (Debian 14.2-1.pgdg110+1) +-- Dumped by pg_dump version 14.2 (Debian 14.2-1.pgdg110+1) + +SET statement_timeout = 0; +SET lock_timeout = 0; +SET idle_in_transaction_session_timeout = 0; +SET client_encoding = 'UTF8'; +SET standard_conforming_strings = on; +SELECT pg_catalog.set_config('search_path', '', false); +SET check_function_bodies = false; +SET xmloption = content; +SET client_min_messages = warning; +SET row_security = off; + +SET default_tablespace = ''; + +SET default_table_access_method = heap; + +-- +-- Name: log; Type: TABLE; Schema: public; Owner: test +-- + +CREATE TABLE public.log ( + id integer NOT NULL, + "timestamp" date NOT NULL, + username text NOT NULL, + logtext text +); + + +ALTER TABLE public.log OWNER TO test; + +-- +-- Name: scanner; Type: TABLE; Schema: public; Owner: test +-- + +CREATE TABLE public.scanner ( + id integer NOT NULL, + name character varying(128) NOT NULL, + active boolean NOT NULL, + "interval" integer DEFAULT 300 NOT NULL, + starttime date, + endtime date, + maxruns integer DEFAULT 1 +); + + +ALTER TABLE public.scanner OWNER TO test; + +-- +-- Data for Name: log; Type: TABLE DATA; Schema: public; Owner: test +-- + +COPY public.log (id, "timestamp", username, logtext) FROM stdin; +\. + + +-- +-- Data for Name: scanner; Type: TABLE DATA; Schema: public; Owner: test +-- + +COPY public.scanner (id, name, active, "interval", starttime, endtime, maxruns) FROM stdin; +\. + + +-- +-- Name: log log_pkey; Type: CONSTRAINT; Schema: public; Owner: test +-- + +ALTER TABLE ONLY public.log + ADD CONSTRAINT log_pkey PRIMARY KEY (id); + + +-- +-- Name: scanner scanner_name_key; Type: CONSTRAINT; Schema: public; Owner: test +-- + +ALTER TABLE ONLY public.scanner + ADD CONSTRAINT scanner_name_key UNIQUE (name); + + +-- +-- Name: scanner scanner_pkey; Type: CONSTRAINT; Schema: public; Owner: test +-- + +ALTER TABLE ONLY public.scanner + ADD CONSTRAINT scanner_pkey PRIMARY KEY (id); + + +-- +-- PostgreSQL database dump complete +-- + -- cgit v1.1