mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
Move schema to homedir, add more docs
Update configs
This commit is contained in:
parent
33a8cdb523
commit
e3783a4919
6 changed files with 34 additions and 16109 deletions
|
@ -6,8 +6,10 @@ VNC_CLEANUP_TOKEN = environ.get('PROXSTAR_VNC_CLEANUP_TOKEN', '')
|
||||||
|
|
||||||
# Development options
|
# Development options
|
||||||
# Determines weather or not to run STARRS queries (for doing stuff like checking for available IPs)
|
# Determines weather or not to run STARRS queries (for doing stuff like checking for available IPs)
|
||||||
USE_STARRS = environ.get('PROXSTAR_USE_STARRS', 'True')
|
USE_STARRS = environ.get('PROXSTAR_USE_STARRS', 'True').lower() in ('true', '1', 't')
|
||||||
FORCE_STANDARD_USER = environ.get('PROXSTAR_FORCE_STANDARD_USER', 'False')
|
# 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
|
# Flask
|
||||||
IP = environ.get('PROXSTAR_IP', '0.0.0.0')
|
IP = environ.get('PROXSTAR_IP', '0.0.0.0')
|
||||||
|
|
|
@ -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
|
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.
|
Clone down the repository, and create a Virtualenv to do your work in.
|
||||||
```
|
```
|
||||||
mkdir venv
|
mkdir venv
|
||||||
|
@ -47,8 +52,11 @@ vim config_local.py
|
||||||
# Flask
|
# Flask
|
||||||
|
|
||||||
# The IP address to which Proxstar is served.
|
# The IP address to which Proxstar is served.
|
||||||
# 0.0.0.0 will serve to wherever you want, and is probably what you want.
|
# You should probably set this to 127.0.0.1 if you're developing on your
|
||||||
IP = environ.get('PROXSTAR_IP', '0.0.0.0')
|
# 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.
|
# The port Proxstar runs on.
|
||||||
# Because sso is configured to accept from `http://localhost:8000', you should
|
# 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', '')
|
PROXMOX_USER = environ.get('PROXSTAR_PROXMOX_USER', '')
|
||||||
# Said user's password
|
# Said user's password
|
||||||
PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '')
|
PROXMOX_PASS = environ.get('PROXSTAR_PROXMOX_PASS', '')
|
||||||
# Location of ISO storage on your server.
|
# Location of ISO storage on your server. CSH has an NFS share for this,
|
||||||
PROXMOX_ISO_STORAGE = environ.get('PROXSTAR_PROXMOX_ISO_STORAGE', 'nfs-iso')
|
# 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)
|
# Username of SSH user (probably the same)
|
||||||
PROXMOX_SSH_USER = environ.get('PROXSTAR_PROXMOX_SSH_USER', '')
|
PROXMOX_SSH_USER = environ.get('PROXSTAR_PROXMOX_SSH_USER', '')
|
||||||
# Paste that SSH key I told you to generate.
|
# Paste that SSH key I told you to generate.
|
||||||
|
@ -121,7 +134,7 @@ vim config_local.py
|
||||||
|
|
||||||
# LDAP
|
# 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_DN = environ.get('PROXSTAR_LDAP_BIND_DN', '')
|
||||||
LDAP_BIND_PW = environ.get('PROXSTAR_LDAP_BIND_PW', '')
|
LDAP_BIND_PW = environ.get('PROXSTAR_LDAP_BIND_PW', '')
|
||||||
|
|
||||||
|
@ -164,10 +177,6 @@ vim config_local.py
|
||||||
TIMEOUT = environ.get('PROXSTAR_TIMEOUT', 120)
|
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.
|
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.
|
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
|
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.
|
Open a web browser and navigate to http://localhost:8000. You should see Proxstar running.
|
||||||
|
|
|
@ -2,11 +2,10 @@ FROM postgres:12
|
||||||
|
|
||||||
RUN apt-get update \
|
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 \
|
&& 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/*
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& cpanm Data::Validate::Domain \
|
||||||
RUN cpanm Data::Validate::Domain
|
&& apt-get remove -y build-essential
|
||||||
|
|
||||||
RUN apt-get remove -y build-essential
|
|
||||||
|
|
||||||
COPY ./schema/large.sql /docker-entrypoint-initdb.d/
|
|
||||||
|
|
||||||
|
#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
|
@ -203,10 +203,7 @@ def isos():
|
||||||
@app.route('/hostname/<string:name>')
|
@app.route('/hostname/<string:name>')
|
||||||
@auth.oidc_auth
|
@auth.oidc_auth
|
||||||
def hostname(name):
|
def hostname(name):
|
||||||
if app.config['USE_STARRS']:
|
valid, available = check_hostname(starrs, name) if app.config['USE_STARRS'] else (True, True)
|
||||||
valid, available = check_hostname(starrs, name)
|
|
||||||
else:
|
|
||||||
valid, available = (True, True)
|
|
||||||
if not valid:
|
if not valid:
|
||||||
return 'invalid'
|
return 'invalid'
|
||||||
if not available:
|
if not available:
|
||||||
|
@ -468,10 +465,9 @@ def create():
|
||||||
if usage_check:
|
if usage_check:
|
||||||
return usage_check
|
return usage_check
|
||||||
else:
|
else:
|
||||||
if app.config['USE_STARRS']:
|
valid, available = (
|
||||||
valid, available = check_hostname(starrs, name)
|
check_hostname(starrs, name) if app.config['USE_STARRS'] else (True, True)
|
||||||
else:
|
)
|
||||||
valid, available = (True, True)
|
|
||||||
|
|
||||||
if valid and available:
|
if valid and available:
|
||||||
if template == 'none':
|
if template == 'none':
|
||||||
|
|
|
@ -196,12 +196,12 @@ def setup_template_task(template_id, name, user, ssh_key, cores, memory):
|
||||||
delete_vm_task(vmid)
|
delete_vm_task(vmid)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
vm = VM(vmid)
|
||||||
if app.config['USE_STARRS']:
|
if app.config['USE_STARRS']:
|
||||||
logging.info('[{}] Registering in STARRS.'.format(name))
|
logging.info('[{}] Registering in STARRS.'.format(name))
|
||||||
set_job_status(job, 'registering in STARRS')
|
set_job_status(job, 'registering in STARRS')
|
||||||
ip = get_next_ip(starrs, app.config['STARRS_IP_RANGE'])
|
ip = get_next_ip(starrs, app.config['STARRS_IP_RANGE'])
|
||||||
register_starrs(starrs, name, app.config['STARRS_USER'], vm.get_mac(), ip)
|
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'])
|
get_vm_expire(db, vmid, app.config['VM_EXPIRE_MONTHS'])
|
||||||
logging.info('[{}] Setting CPU and memory.'.format(name))
|
logging.info('[{}] Setting CPU and memory.'.format(name))
|
||||||
set_job_status(job, 'setting CPU and memory')
|
set_job_status(job, 'setting CPU and memory')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue