Skip to content

Commit

Permalink
WE-642 start refactoring documentation while verifying validity
Browse files Browse the repository at this point in the history
  • Loading branch information
steinsiv committed Nov 15, 2022
1 parent 0438dcd commit 286de61
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 5 deletions.
30 changes: 30 additions & 0 deletions Docker/MongoDb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# MongoDB

## Setup locally

To create and setup mongodb locally, you can use the included `docker-compose.yml` after customising it.

```yml
version: '3.1'

services:
mongo:
image: mongo:4.4.1
container_name: witsml-explorer-db
restart: unless-stopped
ports:
- 27017:27017
volumes:
- ./data:/data/db #Location for data folder can be changed.
environment:
- MONGO_INITDB_ROOT_USERNAME=<insert username>
- MONGO_INITDB_ROOT_PASSWORD=<insert password>
```
Change the username and password and where to put your data (now `./data` folder in current directory)
The data folder will be created when you run `docker compose up` for the first time

```sh
```
4 changes: 2 additions & 2 deletions Dockerfile-api
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /build
COPY Src/Witsml/Witsml.csproj Src/Witsml/Witsml.csproj
COPY Src/WitsmlExplorer.Api/WitsmlExplorer.Api.csproj Src/WitsmlExplorer.Api/WitsmlExplorer.Api.csproj
Expand All @@ -16,7 +16,7 @@ RUN dotnet test -c Release Witsml.Tests --no-restore && \
WORKDIR /build/Src/WitsmlExplorer.Api
RUN dotnet publish -c Release -o out --no-restore --no-build --no-dependencies

FROM mcr.microsoft.com/dotnet/aspnet:6.0 as base
FROM mcr.microsoft.com/dotnet/aspnet:7.0 as base
ARG EXPOSE_PORT=5000
WORKDIR /app
COPY --from=build /build/Src/WitsmlExplorer.Api/out .
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile-frontend
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ENV NEXT_PUBLIC_AZURE_AD_SCOPE_API=${AZURE_AD_SCOPE_API}

RUN yarn test && yarn build && yarn export

FROM nginx:1.22.1-alpine AS final
FROM nginx:1.23.2-alpine AS final
ARG EXPOSE_PORT=3000
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*
Expand Down
4 changes: 2 additions & 2 deletions build_docker_images.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

echo "Building witsmlexplorer-api..."
docker build -t docker.pkg.github.com/equinor/witsml-explorer/witsmlexplorer-api -f Dockerfile-api .
docker build -t witsmlexplorer-api:latest -f Dockerfile-api .

echo "Building witsmlexplorer-frontend..."
docker build -t docker.pkg.github.com/equinor/witsml-explorer/witsmlexplorer-frontend -f Dockerfile-frontend .
docker build -t witsmlexplorer-frontend:latest -f Dockerfile-frontend .
51 changes: 51 additions & 0 deletions docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Deploy and run Witsml-Explorer

## MongoDB
See []()

## Azure CosmosDB
See []()

## Run locally with docker

Build dockerfiles for frontend and backend (see `build_docker_images.sh`, `Dockerfile-api` and `Dockerfile-frontend`)

**Build api and backend images**
```sh
❯ docker build -t witsmlexplorer-api:latest -f Dockerfile-api .
Building witsmlexplorer-api...
[+] Building 114.0s (24/24) FINISHED
❯ docker build -t witsmlexplorer-frontend:latest -f Dockerfile-frontend .
Building witsmlexplorer-frontend...
[+] Building 136.7s (21/21) FINISHED

❯ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
witsmlexplorer-frontend latest 080fabac5c62 53 seconds ago 24.1MB
witsmlexplorer-api latest 2f1eb2b076d1 3 minutes ago 271MB

```

create a `config.json` file containing the mongodb or cososdb credentials you have created.

**mongodb**
```json
}
"MongoDb": {
"Name": "witsml-explorer-db",
"ConnectionString": "mongodb://user:password@localhost"
}
}
```

**cosmosdb**
```json
{
"Db": {
"Uri": "<...>", (Uri from relevant Azure Database => Overview => Uri )
"Name": "<...>", (Container name from relevant Azure Database => DataExplorer || databaseName from config.cfg)
"AuthKey": "<...>" (PrimaryKey from relevant Azure Database => Setting => Keys )
}
"Host": "http[s]://<domain-where-witsml-explorer-is-hosted>"
}
```

0 comments on commit 286de61

Please sign in to comment.