|
2 | 2 |
|
3 | 3 | ## Setup ## |
4 | 4 |
|
5 | | -In order to run this project on your machine, you will need to set up: |
| 5 | +### System dependencies ### |
6 | 6 |
|
7 | | -- [Postgres on Azure](https://azure.microsoft.com/en-us/services/postgresql/) |
| 7 | +In order to run this project on your machine, you will need to install the |
| 8 | +following system-level dependencies: |
| 9 | + |
| 10 | +- [Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest) |
8 | 11 | - [Docker](https://docs.docker.com/docker-for-windows/) |
9 | 12 |
|
10 | | -Once the system dependencies are installed, you can run the project via Docker: |
| 13 | +### Azure resources ### |
| 14 | + |
| 15 | +You will need to set up an instance of [Azure Databases for PostgreSQL](https://azure.microsoft.com/en-us/services/postgresql/) for the featureService. |
| 16 | + |
| 17 | +You can run the following snippet in a Bash shell (such as the [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10)) |
| 18 | +to set up a new instance of Azure Databases for PostgreSQL using the Azure CLI: |
| 19 | + |
| 20 | +```sh |
| 21 | +dbname="----CHANGEME----" # e.g. myfeaturesservicedb |
| 22 | +dbuser="----CHANGEME----" # e.g. admin |
| 23 | +dbpassword="----CHANGEME----" # e.g. featureService1!Rocks |
| 24 | +resource_group="----CHANGEME----" # e.g. myfeaturesserviceresourcegroup |
| 25 | +resource_location="----CHANGEME----" # e.g. eastus |
| 26 | + |
| 27 | +az group create \ |
| 28 | + --name="$resource_group" \ |
| 29 | + --location="$resource_location" |
| 30 | + |
| 31 | +az postgres server create \ |
| 32 | + --name="$dbname" \ |
| 33 | + --admin-user="$dbuser" \ |
| 34 | + --admin-password="$dbpassword" \ |
| 35 | + --resource-group="$resource_group" \ |
| 36 | + --location="$resource_location" \ |
| 37 | + --performance-tier="Standard" |
| 38 | +``` |
| 39 | + |
| 40 | +Next, find the database in the [Azure Portal](https://portal.azure.com) and |
| 41 | +enable clients to connect to the database. You can either white-list particular |
| 42 | +IPs or a range of IPs as shown in the screenshot below: |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +### Running the application ### |
| 47 | + |
| 48 | +Once the system dependencies are installed and your Postgres database has been |
| 49 | +created, you can run the project via Docker: |
11 | 50 |
|
12 | 51 | ```sh |
13 | 52 | docker build -t featureservice . |
14 | 53 |
|
15 | 54 | docker run \ |
16 | 55 | -p 8080:80 \ |
17 | | - -e FEATURES_DB_USER="----CHANGEME----" \ |
18 | | - -e FEATURES_DB_PASSWORD="----CHANGEME----" \ |
19 | | - -e FEATURES_DB_HOST="----CHANGEME----" \ |
20 | | - -t featureservice |
| 56 | + -e FEATURES_DB_USER="$dbuser@$dbname" \ |
| 57 | + -e FEATURES_DB_PASSWORD="$dbpassword" \ |
| 58 | + -e FEATURES_DB_HOST="$dbname.postgres.database.azure.com" \ |
| 59 | + -t featureservice |
21 | 60 | ``` |
22 | 61 |
|
23 | 62 | The first time that you run this command, it will take about 90 minutes while |
|
0 commit comments