mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-02-12 13:01:51 +00:00
Add schemas for development databases
These schemas need to be imported for development purposes. Update Database schemas, add docker compose
This commit is contained in:
parent
b3300de18e
commit
262b5b10eb
12 changed files with 34892 additions and 5 deletions
|
@ -2,9 +2,9 @@
|
|||
|
||||
If you want to work on Proxstar using a 1:1 development setup, there are a couple things you're going to need
|
||||
|
||||
- A machine you can SSH into, portforward from, and run Flask, Redis, and Podman on
|
||||
- A machine you can SSH into, portforward from, and run Flask, Redis, and Docker on
|
||||
- At least one (1) Proxmox host running Proxmox >6.3
|
||||
- Podman
|
||||
- Docker
|
||||
- SSH portforwarding
|
||||
- A CSH account
|
||||
- An RTP (to tell you secrets)
|
||||
|
@ -21,11 +21,14 @@ Clone down the repository, and create a Virtualenv to do your work in.
|
|||
```
|
||||
mkdir venv
|
||||
python3.8 -m venv venv
|
||||
source venv/bin/activate
|
||||
```
|
||||
|
||||
Install required Python modules
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
pip install click==7.1.2
|
||||
pip install python-dotenv
|
||||
```
|
||||
Fill out the required fields in your config.local.py file. Some of this you might have to come back to after you run the docker compose.
|
||||
```
|
||||
|
@ -163,6 +166,10 @@ vim config.local.py
|
|||
|
||||
I'd recommend putting the secrets (such as your login credentials and ssh key) in a `.env` file so you don't have to have it on your screen as you tear your hair out about why this isn't working. Before running the server, insert it into your environment with `source .env`
|
||||
|
||||
```
|
||||
source .env
|
||||
```
|
||||
|
||||
Now, go ahead and run the Docker Compose file to set up your Postgres and Redis instances.
|
||||
|
||||
```
|
||||
|
@ -171,8 +178,14 @@ docker-compose up -d
|
|||
|
||||
Restore the databse in your new podman container. This might throw a TON of errors, but don't worry about it.
|
||||
```
|
||||
psql postgresql://postgres:tits12348@10.10.51.185/starrs < harmon_starrs.db
|
||||
psql postgresql://postgres:tits12348@10.10.51.185/proxstar < restore_proxstar.sql
|
||||
psql postgresql://postgres:********@10.69.69.69
|
||||
CREATE DATABASE proxstar;
|
||||
CREATE DATABASE starrs;
|
||||
quit;
|
||||
|
||||
pg_restore -U postgres -d proxstar -1 proxstar_schema_willard -h localhost
|
||||
psql postgresql://postgres:tits12348@10.10.51.185/starrs < harmon_starrs.db
|
||||
# psql postgresql://postgres:tits12348@10.10.51.185/proxstar < restore_proxstar.sql # Probably unnecessary
|
||||
```
|
||||
|
||||
Now, you should be ready to run your dev instance. I like to use `tmux` for this to run proxstar and the `rq worker` in separate panes.
|
||||
|
|
|
@ -5,7 +5,8 @@ services:
|
|||
ports:
|
||||
- 6379:6379
|
||||
proxstar-postgres:
|
||||
image: postgres
|
||||
build: ./proxstar-postgres
|
||||
# image: postgres
|
||||
# restart: always
|
||||
ports:
|
||||
- 5432:5432
|
||||
|
|
6
developing/proxstar-postgres/Dockerfile
Normal file
6
developing/proxstar-postgres/Dockerfile
Normal file
|
@ -0,0 +1,6 @@
|
|||
FROM postgres:12
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y postgresql-plperl-12 \
|
||||
&& apt-get install -y postgresql-plpython3-12 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
BIN
developing/schema/proxstar/proxstar_schema_willard
Normal file
BIN
developing/schema/proxstar/proxstar_schema_willard
Normal file
Binary file not shown.
277
developing/schema/proxstar/restore.sql
Normal file
277
developing/schema/proxstar/restore.sql
Normal file
|
@ -0,0 +1,277 @@
|
|||
--
|
||||
-- NOTE:
|
||||
--
|
||||
-- File paths need to be edited. Search for $$PATH$$ and
|
||||
-- replace it with the path to the directory containing
|
||||
-- the extracted data files.
|
||||
--
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 12.6
|
||||
-- Dumped by pg_dump version 12.6
|
||||
|
||||
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;
|
||||
|
||||
DROP DATABASE proxstar;
|
||||
--
|
||||
-- Name: proxstar; Type: DATABASE; Schema: -; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE DATABASE proxstar WITH TEMPLATE = template0 ENCODING = 'UTF8' LC_COLLATE = 'en_US.UTF-8' LC_CTYPE = 'en_US.UTF-8';
|
||||
|
||||
|
||||
ALTER DATABASE proxstar OWNER TO postgres;
|
||||
|
||||
\connect proxstar
|
||||
|
||||
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: plperl; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE OR REPLACE PROCEDURAL LANGUAGE plperl;
|
||||
|
||||
|
||||
ALTER PROCEDURAL LANGUAGE plperl OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: plperl_call_handler(); Type: FUNCTION; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.plperl_call_handler() RETURNS language_handler
|
||||
LANGUAGE c
|
||||
AS '$libdir/plperl', 'plperl_call_handler';
|
||||
|
||||
|
||||
ALTER FUNCTION public.plperl_call_handler() OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: plpgsql_call_handler(); Type: FUNCTION; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE FUNCTION public.plpgsql_call_handler() RETURNS language_handler
|
||||
LANGUAGE c
|
||||
AS '$libdir/plpgsql', 'plpgsql_call_handler';
|
||||
|
||||
|
||||
ALTER FUNCTION public.plpgsql_call_handler() OWNER TO postgres;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_table_access_method = heap;
|
||||
|
||||
--
|
||||
-- Name: allowed_users; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.allowed_users (
|
||||
id character varying(32) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.allowed_users OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: ignored_pools; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.ignored_pools (
|
||||
id character varying(32) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.ignored_pools OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: pool_cache; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.pool_cache (
|
||||
pool character varying(32) NOT NULL,
|
||||
vms text[] NOT NULL,
|
||||
num_vms integer NOT NULL,
|
||||
usage json NOT NULL,
|
||||
limits json NOT NULL,
|
||||
percents json NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.pool_cache OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: template; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.template (
|
||||
id integer NOT NULL,
|
||||
name character varying(32) NOT NULL,
|
||||
username text NOT NULL,
|
||||
password text NOT NULL,
|
||||
disk integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.template OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: template_id_seq; Type: SEQUENCE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.template_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.template_id_seq OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: template_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.template_id_seq OWNED BY public.template.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: usage_limit; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.usage_limit (
|
||||
id character varying(32) NOT NULL,
|
||||
cpu integer NOT NULL,
|
||||
mem integer NOT NULL,
|
||||
disk integer NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.usage_limit OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: vm_expiration; Type: TABLE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE TABLE public.vm_expiration (
|
||||
id integer NOT NULL,
|
||||
expire_date date NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.vm_expiration OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: vm_expiration_id_seq; Type: SEQUENCE; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
CREATE SEQUENCE public.vm_expiration_id_seq
|
||||
START WITH 1
|
||||
INCREMENT BY 1
|
||||
NO MINVALUE
|
||||
NO MAXVALUE
|
||||
CACHE 1;
|
||||
|
||||
|
||||
ALTER TABLE public.vm_expiration_id_seq OWNER TO proxstar;
|
||||
|
||||
--
|
||||
-- Name: vm_expiration_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER SEQUENCE public.vm_expiration_id_seq OWNED BY public.vm_expiration.id;
|
||||
|
||||
|
||||
--
|
||||
-- Name: template id; Type: DEFAULT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.template ALTER COLUMN id SET DEFAULT nextval('public.template_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vm_expiration id; Type: DEFAULT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.vm_expiration ALTER COLUMN id SET DEFAULT nextval('public.vm_expiration_id_seq'::regclass);
|
||||
|
||||
|
||||
--
|
||||
-- Name: allowed_users allowed_users_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.allowed_users
|
||||
ADD CONSTRAINT allowed_users_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: ignored_pools ignored_pools_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.ignored_pools
|
||||
ADD CONSTRAINT ignored_pools_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: pool_cache pool_cache_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.pool_cache
|
||||
ADD CONSTRAINT pool_cache_pkey PRIMARY KEY (pool);
|
||||
|
||||
|
||||
--
|
||||
-- Name: template template_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.template
|
||||
ADD CONSTRAINT template_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: usage_limit usage_limit_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.usage_limit
|
||||
ADD CONSTRAINT usage_limit_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: vm_expiration vm_expiration_pkey; Type: CONSTRAINT; Schema: public; Owner: proxstar
|
||||
--
|
||||
|
||||
ALTER TABLE ONLY public.vm_expiration
|
||||
ADD CONSTRAINT vm_expiration_pkey PRIMARY KEY (id);
|
||||
|
||||
|
||||
--
|
||||
-- Name: DATABASE proxstar; Type: ACL; Schema: -; Owner: postgres
|
||||
--
|
||||
|
||||
GRANT ALL ON DATABASE proxstar TO proxstar;
|
||||
|
||||
|
||||
--
|
||||
-- PostgreSQL database dump complete
|
||||
--
|
||||
|
BIN
developing/schema/proxstar/toc.dat
Normal file
BIN
developing/schema/proxstar/toc.dat
Normal file
Binary file not shown.
18793
developing/schema/starrs/old/harmon_starrs.db
Normal file
18793
developing/schema/starrs/old/harmon_starrs.db
Normal file
File diff suppressed because it is too large
Load diff
15797
developing/schema/starrs/old/restore.sql
Normal file
15797
developing/schema/starrs/old/restore.sql
Normal file
File diff suppressed because it is too large
Load diff
BIN
developing/schema/starrs/old/starrs_schema
Normal file
BIN
developing/schema/starrs/old/starrs_schema
Normal file
Binary file not shown.
BIN
developing/schema/starrs/old/starrs_schema_plpython2
Normal file
BIN
developing/schema/starrs/old/starrs_schema_plpython2
Normal file
Binary file not shown.
BIN
developing/schema/starrs/old/toc.dat
Normal file
BIN
developing/schema/starrs/old/toc.dat
Normal file
Binary file not shown.
BIN
developing/schema/starrs/starrs_schema_willard2
Normal file
BIN
developing/schema/starrs/starrs_schema_willard2
Normal file
Binary file not shown.
Loading…
Reference in a new issue