Skip to content

Commit aec449e

Browse files
author
George Schneeloch
committed
Initial setup for micromasters portal
1 parent 7c34db4 commit aec449e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+835
-0
lines changed

.babelrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"presets": ["es2015", "react"],
3+
"ignore": [
4+
"node_modules/**"
5+
]
6+
}

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STATUS_TOKEN=

.eslintrc

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "defaults/configurations/google",
4+
"rules": {
5+
"quotes": [0], // no opinion on ' vs "
6+
"object-curly-spacing": [0],
7+
"new-cap": [0], // allows function calls like Immutable.Map(...)
8+
"max-len": [2, 120, 2], // 120 max line length, tabs count as 2 spaces
9+
"indent": [2, 2], // no tabs, indent is 2 spaces
10+
"newline-after-var": [0],
11+
"react/jsx-indent-props": [2, 2], // no tabs, indent is two spaces
12+
"react/jsx-key": [2], // validate that key prop exists
13+
"react/jsx-no-undef": [2] // disallow undeclared variables in JSX
14+
},
15+
"env": {
16+
"es6": true,
17+
"browser": true,
18+
"node": true,
19+
"mocha": true
20+
},
21+
"ecmaFeatures": {
22+
"jsx": true
23+
},
24+
"plugins": [
25+
"babel",
26+
"react"
27+
]
28+
}

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,28 @@ target/
6060

6161
#Ipython Notebook
6262
.ipynb_checkpoints
63+
64+
# Heroku/Foreman
65+
.env
66+
67+
# webpack
68+
static/bundles
69+
node_modules
70+
71+
# Editor stuff
72+
*.swp
73+
*.orig
74+
75+
/nbproject
76+
.idea/
77+
.redcar/
78+
codekit-config.json
79+
.pycharm_helpers/
80+
81+
.project
82+
.pydevproject
83+
84+
*.DS_Store
85+
86+
# Django static
87+
staticfiles/

.rsync-ignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
.git
3+
.tox
4+
.rsync-ignore
5+
Makefile
6+
README.rst
7+
.DS_Store

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Set Ruby as the language so it doesn't download the pip things. Instead, let docker do that.
2+
language: ruby
3+
cache: bundler
4+
script:
5+
- docker-compose -f travis-docker-compose.yml run web tox
6+
services:
7+
- docker

Dockerfile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
FROM ubuntu:trusty
2+
MAINTAINER ODL DevOps <[email protected]>
3+
4+
5+
# Add package files, install updated node and pip
6+
WORKDIR /tmp
7+
8+
COPY apt.txt /tmp/apt.txt
9+
RUN apt-get update
10+
RUN apt-get install -y $(grep -vE "^\s*#" apt.txt | tr "\n" " ")
11+
12+
# node
13+
RUN curl --silent --location https://deb.nodesource.com/setup_4.x | bash -
14+
RUN apt-get install nodejs -y
15+
16+
# pip
17+
RUN curl --silent --location https://bootstrap.pypa.io/get-pip.py | python3 -
18+
19+
# Add, and run as, non-root user.
20+
RUN mkdir /src
21+
RUN adduser --disabled-password --gecos "" mitodl
22+
23+
# Install project packages
24+
COPY requirements.txt /tmp/requirements.txt
25+
COPY test_requirements.txt /tmp/test_requirements.txt
26+
RUN pip install -r requirements.txt && pip install -r test_requirements.txt
27+
28+
# Add project
29+
COPY . /src
30+
WORKDIR /src
31+
RUN chown -R mitodl:mitodl /src
32+
33+
# Gather static
34+
RUN ./manage.py collectstatic --noinput
35+
RUN apt-get clean && apt-get purge
36+
USER mitodl
37+
38+
# Set pip cache folder, as it is breaking pip when it is on a shared volume
39+
ENV XDG_CACHE_HOME /tmp/.cache
40+
41+
EXPOSE 8079
42+
ENV PORT 8079
43+
CMD uwsgi uwsgi.ini

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# For Docker and OSX development
2+
up:
3+
curl -o /usr/local/bin/docker-osx-dev https://raw.githubusercontent.com/brikis98/docker-osx-dev/master/src/docker-osx-dev
4+
chmod +x /usr/local/bin/docker-osx-dev
5+
docker-osx-dev install
6+
docker-osx-dev -m default -s ./ --ignore-file '.rsync-ignore'

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: uwsgi config.wsgi:application

app.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "micromasters",
3+
"description": "Web Portal for Micromasters",
4+
"keywords": [
5+
"Django",
6+
"Python",
7+
"MIT",
8+
"Office of Digital Learning"
9+
],
10+
"website": "https://github.com/mitodl/micromasters",
11+
"repository": "https://github.com/mitodl/micromasters",
12+
"success_url": "/",
13+
"scripts": {
14+
"postdeploy": "./manage.py migrate"
15+
},
16+
"addons": [
17+
"heroku-postgresql:hobby-dev",
18+
"newrelic:wayne"
19+
],
20+
"buildpacks": [
21+
{
22+
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
23+
},
24+
{
25+
"url": "https://github.com/heroku/heroku-buildpack-python"
26+
}
27+
],
28+
"env": {
29+
"ALLOWED_HOSTS": {
30+
"description": "Array of allowed hostnames",
31+
"default": "['*']"
32+
},
33+
"STATUS_TOKEN": {
34+
"description": "Token to access the status API.",
35+
"required": true
36+
}
37+
}
38+
}

0 commit comments

Comments
 (0)