Azure Deployment Manual

PostgreSQL server

  1. Create a new PostgreSQL server: https://portal.azure.com/#create/Microsoft.PostgreSQLServer
  2. Open the configuration page for the PostgreSQL server you’ve created
  3. Navigate to “Connection Security” under “Settings” in the sidebar
  4. Toggle “Allow access to Azure services” to “On”
  5. Click “Add My IP”
  6. Click “Save”

Create Web App

  1. Create a new Web App in the same resource group as your PostgreSQL server: https://portal.azure.com/#create/Microsoft.WebSite
  2. Open the configuration page for the Web App you’ve created
  3. Navigate to “Extensions” under “Development Tools in” the sidebar
  4. Click “Add”, and install “Python 3.6.4 x86”

Configure Web App

Now we need to provide the Web App with some settings to run:

  1. Navigate to “Application settings” under “Settings” on the sidebar.
  2. Scroll down to “Application settings” and click “Add new setting” for each of the following:
Name Value
DATABASE_NAME postgresql
DATABASE_USER enter the postgresql username you previously created
DATABASE_PASSWORD enter the postgresql password you previously created
DATABASE_HOST enter the domain of the postgresql server you previously created
SECRET_KEY randomly generate a string and enter it here
ALLOWED_HOSTS enter the domain of the web app you’ve created
UCLAPI_CLIENT_ID create UCL API OAuth Credentials and enter the client id here
UCLAPI_CLIENT_SECRET create UCL API OAuth Credentials and enter the client secret here
GOOGLE_MAPS_KEY create a Google Maps API Key and enter it here

Finally click “Save”.

Deploy Web App

  1. Clone the repository: git clone https://github.com/UCLComputerScience/103P_2018_team51.git
  2. Enter the cloned repository: cd 103P_2018_team51
  3. Navigate to your Web App’s overview page
  4. Create a new remote from the “Git clone url” on the Web App Overview page: git remote add azure <paste "Git clone url" here>
  5. Deploy the app to azure with: git push azure master
  6. Enter the previously created deployment credentials when prompted

Create superuser

Run the python3 manage.py createsuperuser command locally by setting the database settings on the command line:

DATABASE_NAME=postgresql DATABASE_USER=<enter value> DATABASE_PASSWORD=<enter value> DATABASE_HOST=<enter value> python3 manage.py createsuperuser

UPI stands for Unique Person Identifier, a unique id given to every member of UCL, set this to your own UPI (found on your UCL ID card) if you want to be able to log into the admin interface through UCL API OAuth.

You can now log into the admin interface at: https://your-domain/admin/login