Skip to content

Commit e9ec75a

Browse files
committed
Add Azure-Postgres setup instructions
1 parent 92aab0a commit e9ec75a

File tree

1 file changed

+46
-7
lines changed

1 file changed

+46
-7
lines changed

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,61 @@
22

33
## Setup ##
44

5-
In order to run this project on your machine, you will need to set up:
5+
### System dependencies ###
66

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)
811
- [Docker](https://docs.docker.com/docker-for-windows/)
912

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+
![Screenshot showing Azure Databases for PostgreSQL firewall configuration](https://user-images.githubusercontent.com/1086421/36278106-c1fd7fe6-1260-11e8-8a22-8311b19f83c7.png)
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:
1150

1251
```sh
1352
docker build -t featureservice .
1453

1554
docker run \
1655
-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
2160
```
2261

2362
The first time that you run this command, it will take about 90 minutes while

0 commit comments

Comments
 (0)