Browse Source

improve local dev env

develop
david 2 years ago
parent
commit
6348e6c148
  1. 2
      .env.development
  2. 5
      Dockerfile
  3. 13
      nginx.conf
  4. 17
      set-env.sh
  5. 3
      supabase/.gitignore
  6. 62
      supabase/config.toml
  7. 715
      supabase/migrations/20220807024048_remote_commit.sql
  8. 20
      supabase/seed.sql
  9. 5
      swarm/build.bash
  10. 8
      swarm/deploy.bash
  11. 31
      swarm/docker-compose.quizzer.yml
  12. 2
      swarm/logs.bash
  13. 2
      swarm/remove.bash
  14. 3
      swarm/restart.bash
  15. 2
      swarm/status.bash

2
.env.development

@ -0,0 +1,2 @@
REACT_APP_SUPABASE_URL=http://localhost:54321
REACT_APP_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24ifQ.625_WdcF3KHqz5amU0x2X5WWHP-OEs_4qj0ssLNHzTs

5
Dockerfile

@ -1,5 +0,0 @@
FROM nginx:alpine
COPY ./build /usr/share/nginx/html
COPY ./set-env.sh /scripts/set-env.sh
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
CMD [ "sh", "-c", "cd /usr/share/nginx/html/ && /scripts/set-env.sh && nginx -g 'daemon off;'" ]

13
nginx.conf

@ -1,13 +0,0 @@
server {
listen 80;
server_name localhost;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

17
set-env.sh

@ -1,17 +0,0 @@
#!/bin/sh
if [ -z $REACT_APP_SUPABASE_URL ] || [ -z $REACT_APP_SUPABASE_ANON_KEY ]; then
echo "missing required variables!"
echo "url: $REACT_APP_SUPABASE_URL"
echo "key: $REACT_APP_SUPABASE_ANON_KEY"
exit 1
else
echo "setting variables!"
echo "url: $REACT_APP_SUPABASE_URL"
echo "key: $REACT_APP_SUPABASE_ANON_KEY"
# sed -i "s|__REACT_APP_SUPABASE_URL__|$REACT_APP_SUPABASE_URL|g" ./build/index.html
# sed -i "s|__REACT_APP_SUPABASE_ANON_KEY__|$REACT_APP_SUPABASE_ANON_KEY|g" ./build/index.html
sed -i "s|__REACT_APP_SUPABASE_URL__|$REACT_APP_SUPABASE_URL|g" /usr/share/nginx/html/index.html
sed -i "s|__REACT_APP_SUPABASE_ANON_KEY__|$REACT_APP_SUPABASE_ANON_KEY|g" /usr/share/nginx/html/index.html
fi
exec "$@"

3
supabase/.gitignore vendored

@ -0,0 +1,3 @@
# Supabase
.branches
.temp

62
supabase/config.toml

@ -0,0 +1,62 @@
# A string used to distinguish different Supabase projects on the same host. Defaults to the working
# directory name when running `supabase init`.
project_id = "quizzer"
[api]
# Port to use for the API URL.
port = 54321
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
# endpoints. public and storage are always included.
schemas = []
# Extra schemas to add to the search_path of every request.
extra_search_path = ["extensions"]
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
# for accidental or malicious requests.
max_rows = 1000
[db]
# Port to use for the local database URL.
port = 54322
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
# server_version;` on the remote database to check.
major_version = 14
[studio]
# Port to use for Supabase Studio.
port = 54323
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
# are monitored, and you can view the emails that would have been sent from the web interface.
[inbucket]
# Port to use for the email testing server web interface.
port = 54324
smtp_port = 54325
pop3_port = 54326
[auth]
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
# in emails.
site_url = "http://localhost:3000"
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
additional_redirect_urls = ["https://localhost:3000"]
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one
# week).
jwt_expiry = 3600
# Allow/disallow new user signups to your project.
enable_signup = true
[auth.email]
# Allow/disallow new user signups via email to your project.
enable_signup = true
# If enabled, a user will be required to confirm any email change on both the old, and new email
# addresses. If disabled, only the new email is required to confirm.
double_confirm_changes = true
# If enabled, users need to confirm their email address before signing in.
enable_confirmations = false
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
# `discord`, `facebook`, `github`, `gitlab`, `google`, `twitch`, `twitter`, `slack`, `spotify`.
[auth.external.apple]
enabled = false
client_id = ""
secret = ""

715
supabase/migrations/20220807024048_remote_commit.sql

@ -0,0 +1,715 @@
--
-- PostgreSQL database dump
--
-- Dumped from database version 14.1
-- Dumped by pg_dump version 14.3 (Debian 14.3-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;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: postgres
--
-- CREATE SCHEMA "public";
ALTER SCHEMA "public" OWNER TO "postgres";
--
-- Name: SCHEMA "public"; Type: COMMENT; Schema: -; Owner: postgres
--
COMMENT ON SCHEMA "public" IS 'standard public schema';
--
-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "pg_stat_statements" WITH SCHEMA "extensions";
--
-- Name: EXTENSION "pg_stat_statements"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "pg_stat_statements" IS 'track planning and execution statistics of all SQL statements executed';
--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "pgcrypto" WITH SCHEMA "extensions";
--
-- Name: EXTENSION "pgcrypto"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "pgcrypto" IS 'cryptographic functions';
--
-- Name: pgjwt; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "pgjwt" WITH SCHEMA "extensions";
--
-- Name: EXTENSION "pgjwt"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "pgjwt" IS 'JSON Web Token API for Postgresql';
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA "extensions";
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
SET default_tablespace = '';
SET default_table_access_method = "heap";
--
-- Name: quiz; Type: TABLE; Schema: public; Owner: supabase_admin
--
CREATE TABLE "public"."quiz" (
"id" bigint NOT NULL,
"created_at" timestamp with time zone DEFAULT "now"(),
"title" character varying,
"description" character varying
);
ALTER TABLE "public"."quiz" OWNER TO "supabase_admin";
--
-- Name: quiz_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin
--
ALTER TABLE "public"."quiz" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "public"."quiz_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: responses; Type: TABLE; Schema: public; Owner: supabase_admin
--
CREATE TABLE "public"."responses" (
"id" bigint NOT NULL,
"created_at" timestamp with time zone DEFAULT "now"(),
"quiz" bigint,
"answers" character varying[],
"options" character varying[],
"question" character varying,
"detail" character varying
);
ALTER TABLE "public"."responses" OWNER TO "supabase_admin";
--
-- Name: responses_id_seq; Type: SEQUENCE; Schema: public; Owner: supabase_admin
--
ALTER TABLE "public"."responses" ALTER COLUMN "id" ADD GENERATED BY DEFAULT AS IDENTITY (
SEQUENCE NAME "public"."responses_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1
);
--
-- Name: quiz quiz_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin
--
ALTER TABLE ONLY "public"."quiz"
ADD CONSTRAINT "quiz_pkey" PRIMARY KEY ("id");
--
-- Name: responses responses_pkey; Type: CONSTRAINT; Schema: public; Owner: supabase_admin
--
ALTER TABLE ONLY "public"."responses"
ADD CONSTRAINT "responses_pkey" PRIMARY KEY ("id");
--
-- Name: responses responses_quiz_fkey; Type: FK CONSTRAINT; Schema: public; Owner: supabase_admin
--
ALTER TABLE ONLY "public"."responses"
ADD CONSTRAINT "responses_quiz_fkey" FOREIGN KEY ("quiz") REFERENCES "public"."quiz"("id");
--
-- Name: quiz Enable access to all users; Type: POLICY; Schema: public; Owner: supabase_admin
--
CREATE POLICY "Enable access to all users" ON "public"."quiz" FOR SELECT USING (true);
--
-- Name: responses Enable access to all users; Type: POLICY; Schema: public; Owner: supabase_admin
--
CREATE POLICY "Enable access to all users" ON "public"."responses" FOR SELECT USING (true);
--
-- Name: quiz; Type: ROW SECURITY; Schema: public; Owner: supabase_admin
--
ALTER TABLE "public"."quiz" ENABLE ROW LEVEL SECURITY;
--
-- Name: responses; Type: ROW SECURITY; Schema: public; Owner: supabase_admin
--
ALTER TABLE "public"."responses" ENABLE ROW LEVEL SECURITY;
--
-- Name: SCHEMA "public"; Type: ACL; Schema: -; Owner: postgres
--
GRANT USAGE ON SCHEMA "public" TO "anon";
GRANT USAGE ON SCHEMA "public" TO "authenticated";
GRANT USAGE ON SCHEMA "public" TO "service_role";
--
-- Name: FUNCTION "algorithm_sign"("signables" "text", "secret" "text", "algorithm" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."algorithm_sign"("signables" "text", "secret" "text", "algorithm" "text") TO "dashboard_user";
--
-- Name: FUNCTION "armor"("bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."armor"("bytea") TO "dashboard_user";
--
-- Name: FUNCTION "armor"("bytea", "text"[], "text"[]); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."armor"("bytea", "text"[], "text"[]) TO "dashboard_user";
--
-- Name: FUNCTION "crypt"("text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."crypt"("text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "dearmor"("text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."dearmor"("text") TO "dashboard_user";
--
-- Name: FUNCTION "decrypt"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."decrypt"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "decrypt_iv"("bytea", "bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."decrypt_iv"("bytea", "bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "digest"("bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."digest"("bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "digest"("text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."digest"("text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "encrypt"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."encrypt"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "encrypt_iv"("bytea", "bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."encrypt_iv"("bytea", "bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "gen_random_bytes"(integer); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."gen_random_bytes"(integer) TO "dashboard_user";
--
-- Name: FUNCTION "gen_random_uuid"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."gen_random_uuid"() TO "dashboard_user";
--
-- Name: FUNCTION "gen_salt"("text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."gen_salt"("text") TO "dashboard_user";
--
-- Name: FUNCTION "gen_salt"("text", integer); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."gen_salt"("text", integer) TO "dashboard_user";
--
-- Name: FUNCTION "hmac"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."hmac"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "hmac"("text", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."hmac"("text", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pg_stat_statements"("showtext" boolean, OUT "userid" "oid", OUT "dbid" "oid", OUT "toplevel" boolean, OUT "queryid" bigint, OUT "query" "text", OUT "plans" bigint, OUT "total_plan_time" double precision, OUT "min_plan_time" double precision, OUT "max_plan_time" double precision, OUT "mean_plan_time" double precision, OUT "stddev_plan_time" double precision, OUT "calls" bigint, OUT "total_exec_time" double precision, OUT "min_exec_time" double precision, OUT "max_exec_time" double precision, OUT "mean_exec_time" double precision, OUT "stddev_exec_time" double precision, OUT "rows" bigint, OUT "shared_blks_hit" bigint, OUT "shared_blks_read" bigint, OUT "shared_blks_dirtied" bigint, OUT "shared_blks_written" bigint, OUT "local_blks_hit" bigint, OUT "local_blks_read" bigint, OUT "local_blks_dirtied" bigint, OUT "local_blks_written" bigint, OUT "temp_blks_read" bigint, OUT "temp_blks_written" bigint, OUT "blk_read_time" double precision, OUT "blk_write_time" double precision, OUT "wal_records" bigint, OUT "wal_fpi" bigint, OUT "wal_bytes" numeric); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pg_stat_statements"("showtext" boolean, OUT "userid" "oid", OUT "dbid" "oid", OUT "toplevel" boolean, OUT "queryid" bigint, OUT "query" "text", OUT "plans" bigint, OUT "total_plan_time" double precision, OUT "min_plan_time" double precision, OUT "max_plan_time" double precision, OUT "mean_plan_time" double precision, OUT "stddev_plan_time" double precision, OUT "calls" bigint, OUT "total_exec_time" double precision, OUT "min_exec_time" double precision, OUT "max_exec_time" double precision, OUT "mean_exec_time" double precision, OUT "stddev_exec_time" double precision, OUT "rows" bigint, OUT "shared_blks_hit" bigint, OUT "shared_blks_read" bigint, OUT "shared_blks_dirtied" bigint, OUT "shared_blks_written" bigint, OUT "local_blks_hit" bigint, OUT "local_blks_read" bigint, OUT "local_blks_dirtied" bigint, OUT "local_blks_written" bigint, OUT "temp_blks_read" bigint, OUT "temp_blks_written" bigint, OUT "blk_read_time" double precision, OUT "blk_write_time" double precision, OUT "wal_records" bigint, OUT "wal_fpi" bigint, OUT "wal_bytes" numeric) TO "dashboard_user";
--
-- Name: FUNCTION "pg_stat_statements_info"(OUT "dealloc" bigint, OUT "stats_reset" timestamp with time zone); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pg_stat_statements_info"(OUT "dealloc" bigint, OUT "stats_reset" timestamp with time zone) TO "dashboard_user";
--
-- Name: FUNCTION "pg_stat_statements_reset"("userid" "oid", "dbid" "oid", "queryid" bigint); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pg_stat_statements_reset"("userid" "oid", "dbid" "oid", "queryid" bigint) TO "dashboard_user";
--
-- Name: FUNCTION "pgp_armor_headers"("text", OUT "key" "text", OUT "value" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_armor_headers"("text", OUT "key" "text", OUT "value" "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_key_id"("bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_key_id"("bytea") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt"("bytea", "bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt"("bytea", "bytea") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt"("bytea", "bytea", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt"("bytea", "bytea", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt_bytea"("bytea", "bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt_bytea"("bytea", "bytea") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt_bytea"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt_bytea"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_decrypt_bytea"("bytea", "bytea", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_decrypt_bytea"("bytea", "bytea", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_encrypt"("text", "bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_encrypt"("text", "bytea") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_encrypt"("text", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_encrypt"("text", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_encrypt_bytea"("bytea", "bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_encrypt_bytea"("bytea", "bytea") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_pub_encrypt_bytea"("bytea", "bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_pub_encrypt_bytea"("bytea", "bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_decrypt"("bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_decrypt"("bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_decrypt"("bytea", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_decrypt"("bytea", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_decrypt_bytea"("bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_decrypt_bytea"("bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_decrypt_bytea"("bytea", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_decrypt_bytea"("bytea", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_encrypt"("text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_encrypt"("text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_encrypt"("text", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_encrypt"("text", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_encrypt_bytea"("bytea", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_encrypt_bytea"("bytea", "text") TO "dashboard_user";
--
-- Name: FUNCTION "pgp_sym_encrypt_bytea"("bytea", "text", "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."pgp_sym_encrypt_bytea"("bytea", "text", "text") TO "dashboard_user";
--
-- Name: FUNCTION "sign"("payload" "json", "secret" "text", "algorithm" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."sign"("payload" "json", "secret" "text", "algorithm" "text") TO "dashboard_user";
--
-- Name: FUNCTION "try_cast_double"("inp" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."try_cast_double"("inp" "text") TO "dashboard_user";
--
-- Name: FUNCTION "url_decode"("data" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."url_decode"("data" "text") TO "dashboard_user";
--
-- Name: FUNCTION "url_encode"("data" "bytea"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."url_encode"("data" "bytea") TO "dashboard_user";
--
-- Name: FUNCTION "uuid_generate_v1"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_generate_v1"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_generate_v1mc"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_generate_v1mc"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_generate_v3"("namespace" "uuid", "name" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_generate_v3"("namespace" "uuid", "name" "text") TO "dashboard_user";
--
-- Name: FUNCTION "uuid_generate_v4"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_generate_v4"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_generate_v5"("namespace" "uuid", "name" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_generate_v5"("namespace" "uuid", "name" "text") TO "dashboard_user";
--
-- Name: FUNCTION "uuid_nil"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_nil"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_ns_dns"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_ns_dns"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_ns_oid"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_ns_oid"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_ns_url"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_ns_url"() TO "dashboard_user";
--
-- Name: FUNCTION "uuid_ns_x500"(); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."uuid_ns_x500"() TO "dashboard_user";
--
-- Name: FUNCTION "verify"("token" "text", "secret" "text", "algorithm" "text"); Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON FUNCTION "extensions"."verify"("token" "text", "secret" "text", "algorithm" "text") TO "dashboard_user";
--
-- Name: TABLE "pg_stat_statements"; Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON TABLE "extensions"."pg_stat_statements" TO "dashboard_user";
--
-- Name: TABLE "pg_stat_statements_info"; Type: ACL; Schema: extensions; Owner: postgres
--
GRANT ALL ON TABLE "extensions"."pg_stat_statements_info" TO "dashboard_user";
--
-- Name: TABLE "quiz"; Type: ACL; Schema: public; Owner: supabase_admin
--
GRANT ALL ON TABLE "public"."quiz" TO "postgres";
GRANT ALL ON TABLE "public"."quiz" TO "anon";
GRANT ALL ON TABLE "public"."quiz" TO "authenticated";
GRANT ALL ON TABLE "public"."quiz" TO "service_role";
--
-- Name: SEQUENCE "quiz_id_seq"; Type: ACL; Schema: public; Owner: supabase_admin
--
GRANT ALL ON SEQUENCE "public"."quiz_id_seq" TO "postgres";
GRANT ALL ON SEQUENCE "public"."quiz_id_seq" TO "anon";
GRANT ALL ON SEQUENCE "public"."quiz_id_seq" TO "authenticated";
GRANT ALL ON SEQUENCE "public"."quiz_id_seq" TO "service_role";
--
-- Name: TABLE "responses"; Type: ACL; Schema: public; Owner: supabase_admin
--
GRANT ALL ON TABLE "public"."responses" TO "postgres";
GRANT ALL ON TABLE "public"."responses" TO "anon";
GRANT ALL ON TABLE "public"."responses" TO "authenticated";
GRANT ALL ON TABLE "public"."responses" TO "service_role";
--
-- Name: SEQUENCE "responses_id_seq"; Type: ACL; Schema: public; Owner: supabase_admin
--
GRANT ALL ON SEQUENCE "public"."responses_id_seq" TO "postgres";
GRANT ALL ON SEQUENCE "public"."responses_id_seq" TO "anon";
GRANT ALL ON SEQUENCE "public"."responses_id_seq" TO "authenticated";
GRANT ALL ON SEQUENCE "public"."responses_id_seq" TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR SEQUENCES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin
--
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON SEQUENCES TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR FUNCTIONS; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin
--
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON FUNCTIONS TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: postgres
--
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "postgres" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";
--
-- Name: DEFAULT PRIVILEGES FOR TABLES; Type: DEFAULT ACL; Schema: public; Owner: supabase_admin
--
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON TABLES TO "postgres";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON TABLES TO "anon";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON TABLES TO "authenticated";
ALTER DEFAULT PRIVILEGES FOR ROLE "supabase_admin" IN SCHEMA "public" GRANT ALL ON TABLES TO "service_role";
--
-- PostgreSQL database dump complete
--

20
supabase/seed.sql

@ -0,0 +1,20 @@
-- in supabase/seed.sql
insert into public.quiz (title, description)
values
('test number one', 'one question with 3 options'),
('test number two', 'one question with 12 options'),
('test number three', 'eight questions with eight options'),
('test number four', 'no questions');
insert into public.responses (quiz, answers, options, question, detail)
values
(1, ARRAY['option 1'], ARRAY['option 1','option 2','option 3'], 'test one, question 1', 'detail for question 1'),
(2, ARRAY['option 2'], ARRAY['option 1','option 2','option 3','option 4','option 5','option 6','option 7','option 8','option 9','option 10','option 11','option 12'], 'im a question for test 2', 'im some detail for test 2'),
(3, ARRAY['option 1'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 1', 'some details'),
(3, ARRAY['option 2'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 2', 'some details'),
(3, ARRAY['option 3'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 3', 'some details'),
(3, ARRAY['option 4'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 4', 'some details'),
(3, ARRAY['option 5'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 5', 'some details'),
(3, ARRAY['option 6'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 6', 'some details'),
(3, ARRAY['option 7'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 7', 'some details'),
(3, ARRAY['option 8'], ARRAY['option 1','option 2','option 3', 'option 4','option 5','option 6','option 7','option 8'], 'test 3 question 8', 'some details');

5
swarm/build.bash

@ -1,5 +0,0 @@
#!/bin/bash
cd ..
rm -rf ./build ./node_modules
npm install && npm run build
docker build -t daveplsno/quizzer:latestLocal .

8
swarm/deploy.bash

@ -1,8 +0,0 @@
# export vars
export $(cat .env.deploy)
# deploy to swarm
docker stack deploy -c ./docker-compose.quizzer.yml --prune quizzer
# unset the env vars
unset $(cat .env.deploy | cut -f 1 -d '=' $1)

31
swarm/docker-compose.quizzer.yml

@ -1,31 +0,0 @@
---
version: '3.8'
networks:
swarmnet-public:
external: true
services:
app:
image: daveplsno/quizzer:${imageTag? Variable not set}
hostname: quizzer
environment:
REACT_APP_SUPABASE_URL: ${REACT_APP_SUPABASE_URL? Variable not set}
REACT_APP_SUPABASE_ANON_KEY: ${REACT_APP_SUPABASE_ANON_KEY? Variable not set}
networks:
- swarmnet-public
deploy:
restart_policy:
condition: on-failure
placement:
constraints:
- node.labels.${quizzerNode? Variable not set} == true
labels:
- traefik.enable=true
- traefik.docker.network=swarmnet-public
- traefik.constraint-label=swarmnet-public
- traefik.http.routers.${quizzerTraefikGrp? Variable not set}.rule=Host(`${quizzerTraefikUrl? Variable not set}`)
- traefik.http.routers.${quizzerTraefikGrp? Variable not set}.entrypoints=websecure
- traefik.http.routers.${quizzerTraefikGrp? Variable not set}.tls=true
- traefik.http.routers.${quizzerTraefikGrp? Variable not set}.tls.certresolver=le
- traefik.http.services.${quizzerTraefikGrp? Variable not set}.loadbalancer.server.port=80

2
swarm/logs.bash

@ -1,2 +0,0 @@
#!/bin/bash
docker service logs quizzer_app -f

2
swarm/remove.bash

@ -1,2 +0,0 @@
#!/bin/bash
docker service rm quizzer_app

3
swarm/restart.bash

@ -1,3 +0,0 @@
#!/bin/bash
docker service scale quizzer_app=0
docker service scale quizzer_app=1

2
swarm/status.bash

@ -1,2 +0,0 @@
#!/bin/bash
docker stack services quizzer
Loading…
Cancel
Save