Make nix the one and only dev environment; remove obsolete tooling

This commit is contained in:
Wolfgang Walther
2020-12-01 00:42:21 +01:00
committed by Wolfgang Walther
parent 1a5f6cce46
commit de5742fc7d
7 changed files with 4 additions and 158 deletions
-13
View File
@@ -1,13 +0,0 @@
FROM debian:jessie
ENV PATH /root/.local/bin:$PATH
RUN apt-get update \
&& apt-get install -y wget libpq-dev pkg-config libpcre3 libpcre3-dev \
postgresql-client debconf locales build-essential libffi-dev libgmp-dev git \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen \
&& locale-gen \
&& echo 'export LC_ALL=en_US.UTF-8' >> /etc/profile \
&& wget -qO- https://get.haskellstack.org/ | sh
-65
View File
@@ -1,65 +0,0 @@
#! /usr/bin/env bash
if [ -z "$1" ]
then
echo "Please supply the connection uri for the user with create database privileges"
exit -1
fi
if [ -z "$2" ]
then
echo "Please supply the test database name"
exit -1
fi
if [[ $1 != postgres://* ]]
then
echo "Please use a valid connection URI (https://www.postgresql.org/docs/current/static/libpq-connect.html#AEN45347)"
exit -1
fi
BASEPATH=$( cd $(dirname $0) ; pwd -P )
URI="$1"
DB=$2
PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" -Xq >/dev/null -c 'select rolcreatedb from pg_authid where rolname = current_user;' 2>/dev/null
if [ $? -ne 0 ]; then
echo "ERROR: Please specify the user with 'Create DB' permissions, and ensure that the default database for the username exists."
exit 1
fi
# plpgsql does not like psql variables, easier to pull this part off with bash variables
PGOPTIONS='-c client_min_messages=WARNING' psql "$URI" -Xq >/dev/null <<EOF
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '$DB'
AND pid <> pg_backend_pid();
drop database if exists "$DB";
-- Find all test users that were members of role 'postgrest_test_author'--that way we don't have to know the
-- test user name (in case it was auto-generated).
DO \$\$
DECLARE
mem text;
BEGIN
FOR mem IN
SELECT pg_get_userbyid(member)
FROM pg_roles r
JOIN pg_auth_members m
ON m.roleid = r.oid
WHERE rolname = 'postgrest_test_author'
LOOP
EXECUTE 'drop role '|| mem || ';';
END LOOP;
END \$\$;
DO \$\$
DECLARE
r text;
BEGIN
FOR r IN
VALUES('postgrest_test_author'),('postgrest_test_anonymous'),('postgrest_test_default_role')
LOOP
EXECUTE 'drop role if exists '|| r || ';';
END LOOP;
END \$\$;
EOF
-30
View File
@@ -1,30 +0,0 @@
version: "3.6"
services:
test:
build:
context: .
dockerfile: Dockerfile.test
depends_on:
- postgres
working_dir: /root/postgrest
volumes:
- ../:/root/postgrest
- stack-linux:/root/.stack
- stack-work:/root/postgrest/.stack-work
command: bash -c "POSTGREST_TEST_CONNECTION=$$(test/create_test_db 'postgres://postgres:postgres@postgres' test_db) stack test"
postgres:
image: postgres:13
environment:
POSTGRES_PASSWORD: postgres
volumes:
- postgres:/var/lib/postgresql/data
volumes:
postgres:
driver_opts:
type: tmpfs
device: tmpfs
stack-linux:
stack-work:
-1
View File
@@ -1 +0,0 @@
pg_dump --host localhost --port 5432 --username "postgres" --no-password --format plain --column-inserts --verbose --file "./test/fixtures/schema.sql" "postgrest_test"