Skip to content

Commit 9ea4380

Browse files
Merge pull request #1 from mongodb-developer/fix-container
Fix container
2 parents d1726ec + 34c96d7 commit 9ea4380

File tree

8 files changed

+34
-19
lines changed

8 files changed

+34
-19
lines changed

.devcontainer/container/commands/import.sh

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use library
2+
3+
db.createUser({
4+
user: "admin",
5+
pwd: "mongodb",
6+
roles: [
7+
{ role: "userAdminAnyDatabase", db: "admin" },
8+
{ role: "dbOwner", db: "library" },
9+
{ role: "readWrite", db: "library" }
10+
]
11+
});
12+
13+
print("User 'admin' created in 'library' database.");
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# we create a user to be able to import data into MongoDB
2+
mongosh .devcontainer/create-library-user.js

.devcontainer/data/library.tgz

-5.59 MB
Binary file not shown.

.devcontainer/devcontainer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@
1212
},
1313
"containerEnv": {
1414
"MONGODB_URI": "mongodb://admin:mongodb@localhost:27017/"
15-
},
16-
"postCreateCommand": "",
15+
},
16+
"postAttachCommand": "sh .devcontainer/create-library-user.sh",
1717
"customizations": {
18-
"codespaces": {"openFiles": []},
18+
"codespaces": {
19+
"openFiles": [
20+
"README.md"
21+
]
22+
},
1923
"vscode": {
2024
"extensions": [
21-
"ms-python.python",
22-
"ms-toolsai.jupyter",
23-
"ms-tools.vscode-jupyter",
2425
"mongodb.mongodb-vscode"
2526
]
2627
}

.devcontainer/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ services:
1717
network_mode: service:mongodb
1818

1919
migrator:
20-
image: public.ecr.aws/v4d7k6c9/relational-migrator:1.13.2
20+
image: public.ecr.aws/v4d7k6c9/relational-migrator:1.14.0
2121
ports:
2222
- "8080:8080"
2323
depends_on:

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"mdb.presetConnections": [
33
{
4-
"name": "mongodb container",
5-
"connectionString": "mongodb://admin:mongodb@localhost:27017"
4+
"name": "MongoDB destination container",
5+
"connectionString": "mongodb://admin:mongodb@mongodb:27017"
66
}
77
]
88
}

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Workshop instructions
44

5-
You can access the lab [here](https://mdb.link/rm-workshop)
5+
You can access the lab instructions [here](https://mdb.link/rm-workshop)
66

77
## Database connection
88

@@ -11,3 +11,11 @@ This codespace runs a `mongodb-local` image, you can connect to it from the VS C
1111
```
1212
mongodb://admin:mongodb@mongodb:27017/
1313
```
14+
15+
## Launch Relational Migrator
16+
17+
Open the codespace URL with port `8080` in your browser.
18+
To import, use this MongoDB Connection string:
19+
```
20+
mongodb://admin:mongodb@mongodb:27017/library?authSource=admin
21+
```

0 commit comments

Comments
 (0)