Skip to content

Commit

Permalink
Fix microsoft#4 and updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
eiximenis committed Dec 14, 2018
1 parent c79ecb9 commit d9bbee3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.sh eol=lf
mvnw eol=lf
30 changes: 30 additions & 0 deletions Documents/RunLocally.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Run Backend Services Locally

The easiest way to run your backend services locally is using _Compose_. To run the services type `docker-compose up` from terminal located in `./Source` folder. This will build (if needed) the Docker images and bring up all the containers.

**Note:** Only Linux containers are supported currently.

## Configurate containers

By default compose file configures all containers to use a SQL Server container, so you don't need to provide any specific configuration. But **Shopping cart API requires additional configuration** that must be provided using environment variables, or even better, through an `.env` file.

To do so, just create a file named `.env` in the same `./Source` folder with following content:

```
COSMOSDB_HOST=<Url of your CosmosDb>
COSMOSDB_AUTHKEY=<AuthKey of your CosmosDb>
```

If you are using Windows, you can run the [CosmosDb emulator](https://docs.microsoft.com/en-us/azure/cosmos-db/local-emulator). If using it, you can use following `.env` file:

```
COSMOSDB_HOST=https://10.75.0.1:8081/
COSMOSDB_AUTHKEY=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
```

## Running using Visual Studio

To run the Backend using Visual Studio, just open the `Tailwind.Traders.Backend.sln`, and set "Docker-compose" as startup project and run the solution. Visual Studio will use the compose file to build and run all the containers.



2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ We have added an ARM template so you can automate the creation of the resources
Please, note that **this only deploys the needed infrastructure**. You need to deploy the services to your infrastructure, following these [instructions](./Documents/DeploymentGuide.md)

* To run the backend locally on your computer follow these [instructions](./Documents/RunLocally.md)

# Running the backend services

Please refer to the [deployment guide](Documents/DeploymentGuide.md) for the required steps to run the backend services.
Expand Down
5 changes: 2 additions & 3 deletions Source/Services/Tailwind.Traders.Cart.Api/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ require('dotenv').config();

const config = {};

config.host = process.env.HOST || "https://localhost:8081/";
config.authKey =
process.env.AUTHKEY || "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
config.host = process.env.HOST;
config.authKey = process.env.AUTHKEY;
config.databaseId = "ShoppingCart";
config.containerId = "Products";

Expand Down
2 changes: 1 addition & 1 deletion Source/docker-compose.override.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ services:
cart.api:
environment:
- HOST=${COSMOSDB_HOST:-https://10.0.75.1:8081} # Emulator URI
- AUTHKEY=${COSMOSDB_AUTHKEY:-C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==} # Emulator AUTHKEY
- AUTHKEY=${COSMOSDB_AUTHKEY}
ports:
- "5007:3001"

Expand Down

0 comments on commit d9bbee3

Please sign in to comment.