Move schema to homedir, add more docs

Update configs
This commit is contained in:
Will Nilges 2021-10-07 01:26:57 -04:00
parent 33a8cdb523
commit e3783a4919
6 changed files with 34 additions and 16109 deletions

View file

@ -6,8 +6,10 @@ VNC_CLEANUP_TOKEN = environ.get('PROXSTAR_VNC_CLEANUP_TOKEN', '')
# Development options
# Determines weather or not to run STARRS queries (for doing stuff like checking for available IPs)
USE_STARRS = environ.get('PROXSTAR_USE_STARRS', 'True')
FORCE_STANDARD_USER = environ.get('PROXSTAR_FORCE_STANDARD_USER', 'False')
USE_STARRS = environ.get('PROXSTAR_USE_STARRS', 'True').lower() in ('true', '1', 't')
# If you're an RTP and want to see a normal user's homepage view, set this to True.
FORCE_STANDARD_USER = environ.get('PROXSTAR_FORCE_STANDARD_USER', 'False').lower() in ('true', '1', 't')
# Flask
IP = environ.get('PROXSTAR_IP', '0.0.0.0')

View file

@ -17,6 +17,11 @@ You will also have to set up a pool on your Proxmox node with your csh username.
2. Set up your environment
If you're trying to run this all on a VM without a graphical web browser, you can forward traffic to your computer using SSH.
```
ssh example@dev-server.csh.rit.edu -L 8000:localhost:8000
```
Clone down the repository, and create a Virtualenv to do your work in.
```
mkdir venv
@ -47,8 +52,11 @@ vim config_local.py
# Flask
# The IP address to which Proxstar is served.
# 0.0.0.0 will serve to wherever you want, and is probably what you want.
IP = environ.get('PROXSTAR_IP', '0.0.0.0')
# You should probably set this to 127.0.0.1 if you're developing on your
# local machine, or portforwarding through SSH.
# 0.0.0.0 will serve to wherever you want. Don't do that unless you know
# what you're doing.
IP = environ.get('PROXSTAR_IP', '127.0.0.1')
# The port Proxstar runs on.
# Because sso is configured to accept from `http://localhost:8000', you should
@ -83,8 +91,13 @@ vim config_local.py
PROXMOX_USER = environ.get('PROXSTAR_PROXMOX_USER', '')
# Said user's password
PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '')
# Location of ISO storage on your server.
PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'nfs-iso')
# Location of ISO storage on your server. CSH has an NFS share for this,
# but usually this is 'local'
PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'local')
# Location of storage for VMs. CSH has a ceph cluster, but change this to
# whatever the name of your cluster's storage is. By default Proxmox uses
# local-lvm
PROXMOX_VM_STORAGE = environ.get('PROXSTAR_PROXMOX_VM_STORAGE', 'ceph')
# Username of SSH user (probably the same)
PROXMOX_SSH_USER = environ.get('PROXSTAR_PROXMOX_SSH_USER', '')
# Paste that SSH key I told you to generate.
@ -121,7 +134,7 @@ vim config_local.py
# LDAP
# Ask an RTP about this. You need them to authenticate. They're somewhere on OKD, probably.
# You can just use your CSH credentials here (remember to keep them hidden!)
LDAP_BIND_DN = environ.get('PROXSTAR_LDAP_BIND_DN', '')
LDAP_BIND_PW = environ.get('PROXSTAR_LDAP_BIND_PW', '')
@ -164,10 +177,6 @@ vim config_local.py
TIMEOUT = environ.get('PROXSTAR_TIMEOUT', 120)
```
```
source .env
```
Now, go ahead and run the Docker Compose file to set up your Postgres and Redis instances.
```
@ -177,13 +186,8 @@ docker-compose up -d
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.
```
flask run -p 8000 -h 0.0.0.0
flask run -p 8000 --cert=adhoc
rq worker
```
If you're trying to run this all on a VM without a graphical web browser, you can forward traffic to your computer using SSH.
```
ssh example@dev-server.csh.rit.edu -L 8000:localhost:8000
```
Open a web browser and navigate to http://localhost:8000. You should see Proxstar running.

View file

@ -2,11 +2,10 @@ FROM postgres:12
RUN apt-get update \
&& apt-get install -y postgresql-plperl-12 postgresql-plpython3-12 libnet-ip-perl libnet-ldap-perl libnet-dns-perl libnet-snmp-perl libnet-server-mail-perl libcrypt-des-perl build-essential cpanminus \
&& rm -rf /var/lib/apt/lists/*
RUN cpanm Data::Validate::Domain
RUN apt-get remove -y build-essential
COPY ./schema/large.sql /docker-entrypoint-initdb.d/
&& rm -rf /var/lib/apt/lists/* \
&& cpanm Data::Validate::Domain \
&& apt-get remove -y build-essential
#COPY ./schema/large.sql /docker-entrypoint-initdb.d/ # Woa there, pal; That's a lot of S C H E M A.
# I volunteer as tribute. DM me if this breaks.
ADD https://csh.rit.edu/~wilnil/proxstar-postgres/large.sql /docker-entrypoint-initdb.d/

File diff suppressed because it is too large Load diff

View file

@ -203,10 +203,7 @@ def isos():
@app.route('/hostname/<string:name>')
@auth.oidc_auth
def hostname(name):
if app.config['USE_STARRS']:
valid, available = check_hostname(starrs, name)
else:
valid, available = (True, True)
valid, available = check_hostname(starrs, name) if app.config['USE_STARRS'] else (True, True)
if not valid:
return 'invalid'
if not available:
@ -468,10 +465,9 @@ def create():
if usage_check:
return usage_check
else:
if app.config['USE_STARRS']:
valid, available = check_hostname(starrs, name)
else:
valid, available = (True, True)
valid, available = (
check_hostname(starrs, name) if app.config['USE_STARRS'] else (True, True)
)
if valid and available:
if template == 'none':

View file

@ -196,12 +196,12 @@ def setup_template_task(template_id, name, user, ssh_key, cores, memory):
delete_vm_task(vmid)
return
vm = VM(vmid)
if app.config['USE_STARRS']:
logging.info('[{}] Registering in STARRS.'.format(name))
set_job_status(job, 'registering in STARRS')
ip = get_next_ip(starrs, app.config['STARRS_IP_RANGE'])
register_starrs(starrs, name, app.config['STARRS_USER'], vm.get_mac(), ip)
vm = VM(vmid)
get_vm_expire(db, vmid, app.config['VM_EXPIRE_MONTHS'])
logging.info('[{}] Setting CPU and memory.'.format(name))
set_job_status(job, 'setting CPU and memory')