-
Notifications
You must be signed in to change notification settings - Fork 14
Server Installation
These are the instructions to get a basic Django web server for CIVET up and running.
To get the CIVET source code:
git clone https://github.com/idaholab/civet.git
This creates a directory in $PWD/civet
.
Further instructions will be based out of this directory.
It is recommended to setup a python virtual environment for CIVET to ensure that exact versions of python
dependencies are installed. This can be either a conda
environment, a virtualenv
, or whatever you prefer.
Once inside the environment, and in the civet
directory run:
pip install -r requirements_test.txt
This installs the bare minimum dependencies for CIVET to work.
By default Django uses MySQL for its database. This should really only be used for development or for a
server with very light load. To use another database please consult the Django documentation on how
to configure civet/settings.py
to use it.
Regardless of the database, these steps need to be performed:
./manage.py makemigrations
./manage.py migrate
./manage.py createsupseruser
The createsuperuser
step creates a user with admin privileges. The password should be strong and kept secret.
If any of these steps fails then make sure you have a suitable python environment.
For a standard server that can interact with github.com, gitlab.com, and bitbucket.org:
./manage.py loaddata public.json
If you are using an internal version of GitHub or GitLab then additional steps would be required and will not be covered here.
At this point you should be able to run:
./manage.py runserver
which starts a local webserver at http://localhost:8000 . Going to this URL in a browser should show a basic CIVET homepage. It will be basically empty since there is no data in the database.
See civet/settings.py
for various settings.
The defaults are setup for testing.
For production there are several settings that should be changed.
-
SECRET_KEY
need to be set to a randomly generated string. Be careful to not commit this to your repo if it is publicly accesible. -
DEBUG
should be set toFalse
-
REMOTE_UPDATE
should be set toTrue
-
INSTALL_WEBHOOK
should be set toTrue
-
WEBHOOK_BASE_URL
should be set to URL for a git server will be able to contact. -
ABSOLUTE_BASE_URL
should be set to the absolute URL for the server
Additionally, set the client_id/secret generated by the git server. For example, set GITHUB_CLIENT_ID
and GITHUB_SECRET_ID
to the values generated by GitHub under <user icon> -> Settings -> OAuth applications
.
The recipes that CIVET will use live in a repository. By default they are in ../civet_recipes
from the top civet directory. This can be changed in civet/settings.py
. You can view some sample recipes at civet_example_recipes.
When the recipes change a command needs to be run so that the database is updated. This can be done manually, by cron job, or some custom program. The command that needs to be run is:
./manage.py load_recipes
This will load all the recipes in ../civet_recipes
. If there is a failure then nothing is changed in the database.