Commit fb9de727 authored by David Haynes's avatar David Haynes 🙆
Browse files

Merge branch '33-docker-redo' into 'upgrade-django'

Resolve "Better dockerization of the project"

See merge request !11
parents 110bf730 82aead53
......@@ -18,49 +18,56 @@
# (You'll need to reverse proxy port 8000 via nginx)
# Set the base image to Ubuntu
FROM ubuntu:16.04
FROM python:2.7
ENV PYTHONUNBUFFERED 1
# File Author / Maintainer
MAINTAINER Student-Run Computing and Technology - GMU
# MAINTAINER Student-Run Computing and Technology - GMU
# Update the sources list
RUN apt-get update
RUN mkdir /whats_open
WORKDIR /whats_open
ADD /requirements/ /whats_open/
RUN pip install -r base.txt
ADD . /whats_open/
# Install basic applications
RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential
# RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential
# Install Python and Basic Python Tools
RUN apt-get install -y python python-dev python-distribute python-pip
# # Install Python and Basic Python Tools
# RUN apt-get install -y python python-dev python-distribute python-pip
# Clone down SRCT-Web
RUN git clone https://github.com/srct/whats-open.git whats-open
# # Clone down SRCT-Web
# RUN git clone https://github.com/srct/whats-open.git whats-open
# Get pip to download and install requirements:
RUN pip install -r /whats-open/requirements.txt
# # Get pip to download and install requirements:
# RUN pip install -r /whats-open/requirements.txt
# Set this to a unique, secure value before building
# (http://www.miniwebtool.com/django-secret-key-generator/)
ENV SECRET_KEY ""
# # Set this to a unique, secure value before building
# # (http://www.miniwebtool.com/django-secret-key-generator/)
# ENV SECRET_KEY ""
# Set the default directory where CMD will execute
WORKDIR /whats-open/whats_open
# # Set the default directory where CMD will execute
# WORKDIR /whats-open/whats_open
# Setup database
RUN python manage.py syncdb --noinput
RUN python manage.py migrate website --noinput
# # Setup database
# RUN python manage.py syncdb --noinput
# RUN python manage.py migrate website --noinput
# Generate static files in the STATIC_ROOT location
# (https://docs.djangoproject.com/en/dev/howto/static-files/deployment/)
RUN python manage.py collectstatic --noinput
# # Generate static files in the STATIC_ROOT location
# # (https://docs.djangoproject.com/en/dev/howto/static-files/deployment/)
# RUN python manage.py collectstatic --noinput
# Add any inital data fixtures
# (https://docs.djangoproject.com/en/dev/howto/initial-data/)
ADD fixtures /whats-open/whats_open/
# Import the loaded fixtures
RUN python manage.py loaddata users schedules
# # Add any inital data fixtures
# # (https://docs.djangoproject.com/en/dev/howto/initial-data/)
# ADD fixtures /whats-open/whats_open/
# # Import the loaded fixtures
# RUN python manage.py loaddata users schedules
# Expose ports
EXPOSE 80
# # Expose ports
# EXPOSE 80
# Use Gunicorn to server the application
CMD gunicorn whats_open.wsgi:application -b 0.0.0.0:80
# # Use Gunicorn to server the application
# CMD gunicorn whats_open.wsgi:application -b 0.0.0.0:80
......@@ -18,8 +18,15 @@ section), but sometimes it's the small things that count, so don't be afraid of
contributing just for a spelling mistake.
If you need help at all please contact any SRCT member in the `#whats-open`
channel in our [slack group](https://srct.slack.com). We want people to contribute, so if you are struggling, or just want to
learn, then we are willing to help.
channel in our [slack group](https://srct.slack.com). We want people to
contribute, so if you are struggling, or just want to learn, then we are
willing to help.
Check out some of the other What's Open projects!
- [https://git.gmu.edu/srct/whats-open-android]()
- [https://git.gmu.edu/srct/whats-open-ios]()
- [https://git.gmu.edu/srct/whats-open-web]()
- [https://git.gmu.edu/srct/whats-open-alexa]()
# Setup instructions for local development
......@@ -91,7 +98,56 @@ the SRCT code respository with SSH.
## 3) Get whats-open up and running
#### Prerequisites & Required Packages
Now that we have `git` setup and cloned down the code you can
cd whats-open/
and get to working on setting up a development environment! There are two options
to go about doing this: `Docker` and `Manual Setup`.
### Docker
We can automate the setup process through [Docker](https://www.docker.com/what-docker)
containers! This allows us to quickly get started and standardize development
environments across machines.
Installing Docker on your system:
- For macOS: [https://docs.docker.com/docker-for-mac/]()
- For Windows: [https://docs.docker.com/docker-for-windows/]()
- For your specific *nix distro: [https://docs.docker.com/engine/installation/]()
Additionally, you will need to install docker-compose: [https://docs.docker.com/compose/install/]()
Next inside the `whats-open/` root directory run:
docker-compose build
If that doesn't work, try:
sudo docker-compose build
Then, follow up with:
docker-compose up
If that doesn't work, try:
sudo docker-compose build
You should see that the server is running by going to [http://localhost:8000]()
in your browser. Any changes you make to your local file system will be mirrored in the server.
If you would like to log into the admin interface then use the following credentials:
```
user: admin@masonlive.gmu.edu
pass: admin
```
### Manual Setup
Manual Setup involves all of the same steps as Docker, but just done manually.
First, install python, pip, and virtualenv on your system.
* `python` is the programming language used for Django, the web framework used by whats-open.
......@@ -111,7 +167,6 @@ you install `python`, `pip`, and `virtualenv`.
Next with,
cd whats-open/
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
......@@ -150,7 +205,6 @@ If you're new to Django and don't know where to start, I highly recommend
giving the [tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/)
a try. However, it leaves out a lot of important things, so remember, Google is
your friend.
For the JavaScript, I will be using jQuery whenever possible because I prefer
it to straight up JavaScript. jQuery has [great
documentation](http://docs.jquery.com/) and I've found [Mozilla's documentation
......
version: '2'
services:
web:
build: .
restart: always
ports:
- '8000:8000'
command: /bin/bash ./startup.sh -python whats_open/manage.py runserver 0.0.0.0:8000
volumes:
- .:/whats_open
environment:
- superuser=admin
- email_domain=@masonlive.gmu.edu
\ No newline at end of file
......@@ -2,3 +2,4 @@ Django>1.10, <1.11
django-autoslug==1.9.3
django-cas-client==1.2.0
djangorestframework==3.6.2
django-model-utils==2.6.1
\ No newline at end of file
python whats_open/manage.py flush --no-input
python whats_open/manage.py makemigrations
python whats_open/manage.py makemigrations website
python whats_open/manage.py migrate
echo "from django.contrib.auth.models import User; User.objects.filter(email='$superuser$email_domain').delete(); User.objects.create_superuser('$superuser$email_domain', '$superuser', 'admin')" | python whats_open/manage.py shell
python whats_open/manage.py runserver 0.0.0.0:8000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment