Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6073a94
Issues/300 (#312)
zebulasampedro May 22, 2018
0b5f18f
Issues/314 (#315)
zebulasampedro May 29, 2018
609af78
Added missing import, fixes #303. (#313)
zebulasampedro May 29, 2018
a56ea71
Use the built-in user admin for the custom user model. Fixes #270. (#…
zebulasampedro May 30, 2018
e1fcb6c
Issues/300 (#312)
zebulasampedro May 22, 2018
a3340ce
Issues/314 (#315)
zebulasampedro May 29, 2018
ab22cfa
Added missing import, fixes #303. (#313)
zebulasampedro May 29, 2018
5b2be8d
Use the built-in user admin for the custom user model. Fixes #270. (#…
zebulasampedro May 30, 2018
28de574
Merge branch 'dev' of github.com:ResearchComputing/RCAMP into dev
zebulasampedro Aug 23, 2018
8ad15d5
Updated query form, fixes #319. (#328)
zebulasampedro Aug 24, 2018
7cbb773
Order by username instead of primary key. Fixes #304. (#329)
zebulasampedro Aug 27, 2018
1bf3644
Issues/307 (#331)
zebulasampedro Aug 29, 2018
3a7f729
Rephrased password prompt to call out Duo explicitly. Closes #309.
zebulasampedro Aug 29, 2018
7e71009
Added systemctl service and uid args to compose config.
zebulasampedro Dec 3, 2018
9e33c2b
Added self-signed cert gen for staging.
zebulasampedro Dec 4, 2018
74bb414
Fixed syntax error.
zebulasampedro Dec 4, 2018
0fb7380
Issues/333 (#337)
zebulasampedro Dec 13, 2018
a67c318
Issues/338 (#339)
zebulasampedro Dec 14, 2018
a53f791
Restructure (#345)
zebulasampedro Feb 4, 2019
7eda248
Removed submodule and simplified build.
zebulasampedro Feb 4, 2019
67cb41d
Updated README, and pared down deprecated tests.
zebulasampedro Feb 5, 2019
179e48f
Fixed the bit where I overrode defaults with an empty string.
zebulasampedro Feb 5, 2019
6f02bc5
Make sure test infrastructure is up first.
zebulasampedro Feb 5, 2019
71d8c1e
Removed extraneous entrypoint from test command.
zebulasampedro Feb 5, 2019
7dcd8d3
Give Travis some time to set up the db.
zebulasampedro Feb 5, 2019
a541861
Issues/300 (#312)
zebulasampedro May 22, 2018
fe2d616
Issues/314 (#315)
zebulasampedro May 29, 2018
dba5da9
Added missing import, fixes #303. (#313)
zebulasampedro May 29, 2018
07be046
Use the built-in user admin for the custom user model. Fixes #270. (#…
zebulasampedro May 30, 2018
cbb43dc
Issues/300 (#312)
zebulasampedro May 22, 2018
4028e70
Updated query form, fixes #319. (#328)
zebulasampedro Aug 24, 2018
81a0ecf
Issues/307 (#331)
zebulasampedro Aug 29, 2018
0e37f02
Rephrased password prompt to call out Duo explicitly. Closes #309.
zebulasampedro Aug 29, 2018
52bc040
Added systemctl service and uid args to compose config.
zebulasampedro Dec 3, 2018
3221cfc
Added self-signed cert gen for staging.
zebulasampedro Dec 4, 2018
873d684
Fixed syntax error.
zebulasampedro Dec 4, 2018
843ea6e
Issues/333 (#337)
zebulasampedro Dec 13, 2018
fee0e12
Issues/338 (#339)
zebulasampedro Dec 14, 2018
ff7e0dc
Restructure (#345)
zebulasampedro Feb 4, 2019
4bd3d60
Removed submodule and simplified build.
zebulasampedro Feb 4, 2019
5efa944
Updated README, and pared down deprecated tests.
zebulasampedro Feb 5, 2019
ae4f22b
Fixed the bit where I overrode defaults with an empty string.
zebulasampedro Feb 5, 2019
c40679b
Make sure test infrastructure is up first.
zebulasampedro Feb 5, 2019
6ebeb83
Removed extraneous entrypoint from test command.
zebulasampedro Feb 5, 2019
5bbf0b5
Give Travis some time to set up the db.
zebulasampedro Feb 5, 2019
d088e00
Merge branch 'dev' of github.com:ResearchComputing/RCAMP into dev
zebulasampedro Feb 5, 2019
8ae11eb
Issues/340 (#346)
zebulasampedro Feb 6, 2019
6b6400f
All users will now be added to existing org-appropriate license group…
zebulasampedro Feb 6, 2019
3d5b5fc
Moved useradd to entrypoint script. (#350)
zebulasampedro Mar 5, 2019
03d614d
Fixed issue with how uwsgi uid/gid numbers were being handled.
zebulasampedro Mar 6, 2019
0bd55eb
Fixed uid and gid params in uwsgi config.
zebulasampedro Mar 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/.git
**/.py[cod]
**/.DS_Store
**/.env
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,9 @@ docs/_build/

# PyBuilder
target/

# Docker stuff:
.env

# Miscellaneous
.DS_Store
23 changes: 23 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
sudo: required
language: python
services:
- docker

before_install:
- pip install --upgrade docker-compose

install:
- export UWSGI_UID=$(id -u)
- export UWSGI_GID=$(id -g)
- docker-compose build
- docker-compose up -d
- docker-compose exec rcamp-uwsgi bash -c 'sleep 30s && python manage.py migrate'

script:
- docker-compose exec rcamp-uwsgi python manage.py test

notifications:
email: false
slack:
rooms:
secure: sEWHI86XLXXuVAQd15UbDMPpDKop/bTDn/XynrLKqp+GF+28h8BtewVZXCMHHir3ZCFdb2oRqG1qJ+g3kr8AY5xCadt8xu7BYZTAbGJdlv4tqTuGCNdUTr60wkafmvqYx2UZuawTLLAfy31bgzfGcpq068ni0MxYIn4PNJq0lqcUZoFvhlTT5lXrBWhu7q4JCTvfCBni/shjWKW8zmP5QP1GXSpPeHI9AZmBr2luczc2izVJbyTPEipNk1a57l8D5MeAGz+LE8AkXgbd3yl3KWgU+ZgUd8Jga09B9oARBBqG/1sVb1pCAkQQ2qDd+nByNfkPbcOn0LXhT6LM8sX/HVi7NZD1byB/u6qiycmDvf2rb+7Xz7Z2/eN4Rycf5+3JBuKCg2eFbX0Beo3RLJgmn+dYbWqD3YRAupv8nwZci2Km6AS3cWJi3HhQK85r6xGrmWdW5yqMxbaxiz2PAjtwb2aIdaMb+kgYsuDiYBLprNLWRl8sp3feyxWNCeudtQBxrbDX6gGjri2m8IQlDJv+LRwFaFgGF2xkAy/JMpVdDncqLAQrkjVaQbap1uZYVQyafWDPdLQbMdlt+bR92/bqoD9oZLRVsmOiVfLwxki20jm0cQfOQJL3nRIccdrFSLejMmxc+u6aE8EWSHHswoERmU6H4mDSIotV9jhQSNW3qEU=
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM centos:7
MAINTAINER Zebula Sampedro <sampedro@colorado.edu>

# Install gosu to drop user and chown shared volumes at runtime
RUN export GOSU_VERSION=1.10 && \
yum -y install epel-release && \
yum -y install wget dpkg && \
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" && \
wget -O /usr/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" && \
wget -O /tmp/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc" && \
export GNUPGHOME="$(mktemp -d)" && \
gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && \
gpg --batch --verify /tmp/gosu.asc /usr/bin/gosu && \
rm -r "$GNUPGHOME" /tmp/gosu.asc && \
chmod +x /usr/bin/gosu; \
gosu nobody true && \
yum -y remove wget dpkg && \
yum clean all && \
unset GOSU_VERSION

WORKDIR /opt

# Install core dependencies
RUN yum -y update && \
yum makecache fast && \
yum -y groupinstall "Development Tools" && \
yum -y install epel-release curl which wget && \
yum -y install sssd pam-devel openssl-devel && \
yum -y install python-devel python2-pip && \
yum -y install openldap-devel MySQL-python

ADD requirements.txt /opt/
RUN pip2 install --upgrade pip && \
pip2 install -r requirements.txt && \
pip2 install -e git://github.com/ResearchComputing/django-ldapdb.git@v0.5.1#egg=django-ldapdb

# Add uwsgi conf
COPY uwsgi.ini /opt/uwsgi.ini

# Add codebase to container
COPY rcamp /opt/rcamp

WORKDIR /opt/rcamp
# Set gosu entrypoint and default command
COPY docker-entrypoint.sh /usr/local/bin/
ENTRYPOINT ["sh","/usr/local/bin/docker-entrypoint.sh"]
CMD ["/usr/bin/uwsgi", "/opt/uwsgi.ini"]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2016 Zebula Sampedro
Copyright (c) 2018 Zebula Sampedro

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
39 changes: 14 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,41 +15,30 @@ Research Computing Administrative &amp; Management Portal

**rcamp** - The rcamp directory contains site code and, most importantly, settings.

## Installation
## Setting up your dev environment
You will need Docker 18.03+ and Compose 1.21+ before you begin. Documentation for Docker can be found here: https://docs.docker.com/install/.

Clone RCAMP
Start by cloning RCAMP.
```
git clone https://github.com/ResearchComputing/RCAMP
$ git clone https://github.com/ResearchComputing/RCAMP
$ cd RCAMP
```

Install the RC fork of django-ldapdb
Build your dev environment and then start it using Compose.
```
git clone https://github.com/ResearchComputing/django-ldapdb
cd django-ldapdb
python setup.py install
$ docker-compose build
$ docker-compose up -d
```

Install remaining project dependencies
Finish by migrating the DB and adding a superuser to the RCAMP app. You'll need to attach to the running RCAMP service to do this:
```
cd ../RCAMP
pip install -r requirements.txt
$ docker-compose exec --entrypoint "python" rcamp-uwsgi manage.py migrate
$ docker-compose exec -it --entrypoint "python" rcamp-uwsgi manage.py createsuperuser
```

Configure local settings. Configuration in `local_settings.py` will override configuration in `settings.py`.
```
cd rcamp/rcamp
touch local_settings.py
# Configure fields in local_settings as needed.
```
Collect static files
```
python manage.py collectstatic
```
## Writing and Running Tests
Documentation on use and installation of the RCAMP test framework can be found in the RCAMP Wiki [Test Framework page](https://github.com/ResearchComputing/RCAMP/wiki/Test-Framework).

Set up the database (SQLite3 preferred for dev/testing).
```
python manage.py migrate
$ docker-compose run --rm --entrypoint "python" rcamp-uwsgi manage.py test
```

## Writing and Running Tests
Documentation on use and installation of the RCAMP test framework can be found in the RCAMP Wiki [Test Framework page](https://github.com/ResearchComputing/RCAMP/wiki/Test-Framework).
3 changes: 3 additions & 0 deletions add_pam_users.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
docker exec rcamp-uwsgi bash -c "yum -y install openssl && useradd -M -p $(echo password | openssl passwd -1 -stdin) testuser1"
docker exec rcamp-uwsgi bash -c "useradd -M -p $(echo password | openssl passwd -1 -stdin) testuser2"
16 changes: 16 additions & 0 deletions dev-environment.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
HOSTNAME=127.0.0.1
RCAMP_DEBUG=True
RCAMP_SECRET_KEY=supersecret
RCAMP_ALLOWEDHOSTS=localhost
RCAMP_DB_USER=root
RCAMP_DB_PASSWORD=password
RCAMP_DB_HOST=database
RCAMP_RC_LDAP_URI=ldap://ldap
RCAMP_RC_LDAP_USER=cn=Directory Manager
RCAMP_RC_LDAP_PASSWORD=password
RCAMP_UCB_LDAP_URI=ldap://ldap
RCAMP_UCB_LDAP_USER=cn=Directory Manager
RCAMP_UCB_LDAP_PASSWORD=password
RCAMP_CSU_LDAP_URI=ldap://ldap
RCAMP_CSU_LDAP_USER=cn=Directory Manager
RCAMP_CSU_LDAP_PASSWORD=password
20 changes: 0 additions & 20 deletions dev-requirements.txt

This file was deleted.

43 changes: 43 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: "3.6"

services:
rcamp-uwsgi:
build:
context: .
container_name: rcamp-uwsgi
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
env_file:
- dev-environment.env
environment:
- UWSGI_UID=${UWSGI_UID}
- UWSGI_GID=${UWSGI_GID}
volumes:
- ./rcamp:/opt/rcamp
- ./ldapdb:/opt/ldapdb
- static-content:/opt/static
- media-uploads:/opt/media
- rcamp-logs:/opt/logs
ports:
- "8000:8000"
depends_on:
- database
- ldap

database:
image: mysql:5.7
container_name: database
environment:
- MYSQL_ROOT_PASSWORD=password
- MYSQL_DATABASE=rcamp1712
volumes:
- database:/var/lib/mysql

ldap:
image: researchcomputing/rc-test-ldap
container_name: ldap

volumes:
static-content:
media-uploads:
rcamp-logs:
database:
21 changes: 21 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

STATIC_DIR=/opt/static
MEDIA_DIR=/opt/media
LOG_DIR=/opt/logs
RCAMP_DIR=/opt/rcamp
UWSGI_CONFIG=/opt/uwsgi.ini

# Ensure the uwsgi user and group are set
: ${UWSGI_UID:?"You must set UWSGI_UID to identify the user to run RCAMP."}
: ${UWSGI_GID:?"You must set UWSGI_GID to identify the group to run RCAMP."}

# Collect static, and set permissions of shared volumes.
RCAMP_DEBUG=True bash -c 'python manage.py collectstatic --noinput'
chown -R $UWSGI_UID:$UWSGI_GID $STATIC_DIR
chown -R $UWSGI_UID:$UWSGI_GID $MEDIA_DIR
chown -R $UWSGI_UID:$UWSGI_GID $LOG_DIR
chown -R $UWSGI_UID:$UWSGI_GID $RCAMP_DIR
chown $UWSGI_UID:$UWSGI_GID $UWSGI_CONFIG

exec gosu $UWSGI_UID:$UWSGI_GID "$@"
3 changes: 2 additions & 1 deletion rcamp/accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.contrib.auth import admin as auth_admin
from django import forms
from lib.fields import LdapCsvField
from accounts.models import (
Expand All @@ -14,7 +15,7 @@


@admin.register(User)
class UserAdmin(admin.ModelAdmin):
class UserAdmin(auth_admin.UserAdmin):
list_display = ['username','organization','first_name','last_name','email']
search_fields = ['username','first_name','last_name','email']

Expand Down
18 changes: 17 additions & 1 deletion rcamp/accounts/management/commands/givesuperuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,30 @@
import datetime
import sys

from lib.test.ldap import get_ldap_user_defaults
from lib.ldap_utils import get_ldap_username_and_org
from accounts.models import (
User,
RcLdapUser
)


def get_ldap_user_defaults():
"""Return a dictionary of reasonable defaults for creating RcLdapUser objects via the ORM."""
ldap_user_defaults = dict(
username = 'testuser',
first_name = 'Test',
last_name = 'User',
full_name = 'User, Test',
email = 'testuser@colorado.edu',
modified_date=datetime.datetime(2015,11,06,03,43,24),
uid = 1010,
gid = 1010,
gecos='Test User,,,',
home_directory='/home/testuser'
)
return ldap_user_defaults


class Command(BaseCommand):
help = 'Gives superuser status to the specified user.'

Expand Down
16 changes: 8 additions & 8 deletions rcamp/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,15 @@ def create_user_from_request(self,**kwargs):
organization=organization
)

# Add CU users to ucb posix group
if ('ucb' in settings.LICENSE_GROUPS) and (organization == 'ucb'):
license_grp = settings.LICENSE_GROUPS['ucb']
ucb_grps = RcLdapGroup.objects.filter(name=license_grp)
if ucb_grps.count() > 0:
ucb_grp = ucb_grps[0]
# Add users to org-appropriate posix group
if (organization in settings.LICENSE_GROUPS) and (organization == organization):
license_grp = settings.LICENSE_GROUPS[organization]
org_grps = RcLdapGroup.objects.filter(name=license_grp)
if org_grps.count() > 0:
org_grp = org_grps[0]
# TODO: Extend ldapdb ListField to include an append method.
ucb_grp.members = ucb_grp.members + [username]
ucb_grp.save(organization='ucb')
org_grp.members = org_grp.members + [username]
org_grp.save(organization=organization)

return user

Expand Down
37 changes: 2 additions & 35 deletions rcamp/accounts/templates/account-request-intent.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,14 @@
<link href="/static/css/account-request.css" rel="stylesheet"/>
{% endblock %}

{% block jumbotron_heading %}<h1>Account Request</h1>{% endblock %}
{% block jumbotron_subheading %}
<p>Request an account with University of Colorado Boulder Research Computing.</p>
{% endblock %}
{% block jumbotron_button %}
<p><a data-toggle="modal" href="#helpmodal"
class="btn btn-primary btn-lg" role="button">Definitions &amp; Form Help &raquo;</a></p>
{% endblock %}

{% block modal_title %}
<h4 class="modal-title">Definitions &amp; Form Help</h4>
{% endblock %}
{% block modal_body %}
<ul class="list-group">
<li class="list-group-item">
<strong>Summit supercomputing cluster (2016)</strong>
<p>Summit is a heterogeneous supercomputing cluster based primarily on the Intel Xeon "Haswell" CPU, with secondary NVidia Tesla K80 and high-memory resources and, in the future, an Intel Xeon Phi "knights landing" MIC resource. It replaces Janus as Research Computing's flagship computational resource. All nodes sit on a first-generation Intel Omni-Path Architecture interconnect which also provides access to an IBM GPFS Parallel scratch file system. <a href="https://www.colorado.edu/rc/resources/summit">Learn more about Summit.</a></p>
</li>
<li class="list-group-item">
<strong>Blanca "condo" compute cluster</strong>
<p>The Research Computing Condo Computing service offers researchers the opportunity to purchase and own compute nodes that will be operated as part of the Blanca compute cluster. The aggregate cluster is made available to all condo partners while maintaining priority for the owner of each node. <a href="https://www.colorado.edu/rc/resources/blanca">Learn more about Blanca.</a></p>
</li>
<li class="list-group-item">
<strong>PetaLibrary/active disk storage</strong>
<p>The PetaLibrary/active storage service is mounted at <code>/work/</code> on all Research Computing computational systems. This storage may be used by compute workloads, but it is not designed to be performant under I/O-intensive applications or parallel writes. <a href="https://www.colorado.edu/rc/resources/petalibrary">Learn more about PetaLibrary.</a></p>
</li>
<li class="list-group-item">
<strong>PetaLibrary/archive long-term disk+tape storage</strong>
<p>PetaLibrary/archive is a hierarchical storage system that dynamically and simultaneously manages data on both disk and tape storage systems while presenting all data as part of a single, unified filesystem namespace. This provides good performance when accessing frequently-used data while remaining cost-effective for storing large quantities of archive data. <a href="https://www.colorado.edu/rc/resources/petalibrary">Learn more about PetaLibrary.</a></p>
</li>
</ul>
{% endblock %}

{% block container %}
<div class="mailto-help">
Questions about the account request process?
<a href="mailto:rc-help@colorado.edu?subject=Question%20About%20Account%20Request%20Process">
Contact us
</a>
or view our
<a href="https://github.com/ResearchComputing/Research-Computing-User-Tutorials/wiki">
<a href="https://curc.readthedocs.io/en/latest/">
Documentation.
</a>
</div>
Expand Down Expand Up @@ -212,7 +179,7 @@ <h4 class="modal-title">Definitions &amp; Form Help</h4>
<div class="checkbox">
<label>
<input id="id_reason_blanca" class="reason-checkbox" type="checkbox" name="reason_blanca" {% if form.reason_blanca.value %}checked{% endif %}>
My research group has purchased nodes in the <strong>Blanca Cluster</strong>, or I plan to purchase Blanca nodes for use with my project. <a href="https://www.colorado.edu/rc/resources/blanca">Learn more about Blanca.</a>
My research group has purchased condo nodes, either on Summit or in the <strong>Blanca Cluster</strong>, or I plan to purchase Blanca nodes for use with my project <em>(Summit condo is no longer available for purchase).</em> <a href="https://www.colorado.edu/rc/resources/blanca">Learn more about Blanca.</a>
</label>
</div>
</fieldset>
Expand Down
Loading