Skip to content

Commit

Permalink
Finalise docker instructions + don’t load from LOCAL_SETTINGS when ru…
Browse files Browse the repository at this point in the history
…nning in Docker
  • Loading branch information
philipbelesky committed Feb 5, 2017
1 parent 3571403 commit fd1ab6f
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
10 changes: 9 additions & 1 deletion bin/osx_docker_start.command
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#!/usr/bin/env bash
# Front-end to starting docker for OSX

# Get directory this is being run from
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

# Go there then go up
cd "${DIR}"
cd ..
docker-compose up

# Do docker stuff
docker-compose up

# Open the URL
open http://0.0.0.0:8000
3 changes: 3 additions & 0 deletions bin/windows_docker_start.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,8 @@ SET COMPOSE_CONVERT_WINDOWS_PATHS=1
:: Run docker
docker-compose up

:: Open the webiste
start "" http://localhost:8000

:: Don't just vanish after doing it
cmd /k
18 changes: 9 additions & 9 deletions docs/install/docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
Installing Locally using Docker
===============================

Docker allows us to easily running a seperate operating system and collection of software. This means that we can bundle everything necessary to run Tabbycat into a single, isolated, 'virtual machine' rather than having users install all the needed components step-by-step. Once installed this virtual machine acts as a webserver and database that run Tabbycat, and can be started and stopped whenever you need to run Tabbycat.
Docker is an application that makes it very easy to load and run a specific collection of software. It allows us to bundle everything necessary to run Tabbycat into a single 'virtual machine' rather than have users install everything needed step-by-step. Once setup Docker will allow you to start and stop a webserver (that in turn runs Tabbycat) whenever you need.

1. Install Docker
=================

Docker offers a installer for Windows and OSX. Go to the relevant page linked below, download the *Stable Channel*, then open the file and follow the isntall prompts.
Docker offers a standard installer for Windows and OS X. Go to the relevant page linked below, download the *Stable Channel* build, then open the file and follow the install prompts.

- `Docker for Mac download page <https://docs.docker.com/docker-for-mac/>`_.
- `Docker for Windows download page <https://docs.docker.com/docker-for-windows/>`_.

.. note:: Docker requires Windows 10. Before or shortly after installing
Docker will ask you to enable hypervisor and restart your PC. You must do this step.

- If you're on Linux `follow the instructions for your particular release here <https://docs.docker.com/engine/installation/linux/>`_.
- If you run Linux `follow the instructions for your particular release here <https://docs.docker.com/engine/installation/linux/>`_.

2. Download Tabbycat
====================
Expand All @@ -31,16 +31,16 @@ Docker offers a installer for Windows and OSX. Go to the relevant page linked be
3. Run Tabbycat in Docker
=========================

1. Ensure docker app is open (there will be a whale icon in your menu/task bar) and that it says that docker is running.
1. Ensure that Docker application is open (there should be a whale icon in your menu/task bar) and that it says that Docker is running.

2. Browse to the location where you extracted Tabbycat to, then open up the ``bin`` folder.
2. Browse to the location where you extracted Tabbycat to and then open up the **bin** folder there. Within that folder:

- If on OSX, open ``osx_docker_start.command``
- If on Windows, open ``windows_docker_start.bat``
- If on OSX, open **osx_docker_start.command**
- If on Windows, open **windows_docker_start.bat**
- If on Linux, open up a terminal in the Tabbycat folder (ie the folder containing ``README.md``) and run ``$ docker-compose up``

3. A terminal window should popup and bunch of text scroll by. If this is your first time running Docker it may take up to half an hour to download and setup the virtul machine.

4. Once the new text stops being added you should be able to go to a web and open up http://localhost:8000/ (Windows) or http://0.0.0.0:8000 (OSX/Linux) and see your new Tabbycat website.
4. Once the new text has stopped scrolling for a little while it should automatically open up the Tabbycat site in your default browser. If this doesn't happen navigation to http://localhost:8000/ (On Windows) or http://0.0.0.0:8000 (On OSX/Linux) yourself.

.. note:: If you want to reopen Tabbycat at a later time (say after restarting) repeat steps 1 through 3 here.
.. note:: If you want to reopen Tabbycat at a later time (say after restarting) repeat steps 1 through 3 under 'Run Tabbycat in Docker'.
21 changes: 10 additions & 11 deletions tabbycat/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@
}
}

# ==============================================================================
# Local Overrides and Docker
# ==============================================================================

if os.environ.get('IN_DOCKER', '') and bool(int(os.environ['IN_DOCKER'])):
ALLOWED_HOSTS = ["0.0.0.0", "localhost"]
Expand All @@ -302,15 +305,11 @@
'PORT': 5432, # Non-standard to prvent collisions
}
}

# ==============================================================================
# Local Overrides
# ==============================================================================

try:
LOCAL_SETTINGS
except NameError:
else:
try:
from local_settings import * # flake8: noqa
except ImportError:
pass
LOCAL_SETTINGS
except NameError:
try:
from local_settings import * # flake8: noqa
except ImportError:
pass

0 comments on commit fd1ab6f

Please sign in to comment.