Skip to content

Commit 04e3708

Browse files
authored
Merge pull request #5 from mongodb-developer/revamp-prerequisites
Revamped prerequisites, improved instructions overall
2 parents 93b9c58 + e2801bd commit 04e3708

18 files changed

+158
-108
lines changed

β€Ždocs/10-intro.mdxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import TabItem from '@theme/TabItem';
1313
||- Importing a Relational DB: import the Schema|
1414
||- Map the relational schema to a MongoDB schema|
1515
||- Migrate the data to MongoDB|
16-
|Prerequisites| See [Prerequisites](/docs/prerequisites/)|
16+
|Prerequisites| See [Prerequisites](/docs/category/-prerequisites/)|
1717
|Time to complete|1 hour|
1818

1919
These labs are meant to be presented by one of our amazing instructors, but you can also do them on your own.

β€Ždocs/20-prerequisites.mdxβ€Ž

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
sidebar_position: 20
3+
---
4+
5+
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
7+
# πŸ‘ PostgreSQL Database
8+
9+
In this lab you will be migrating data from a PostgreSQL relational database. You have a few options to set up this database.
10+
11+
### Option 1: Use a pre-configured database
12+
13+
If you are participating in an instructor-led lab, they may have already set up this database for you. Ask your instructor for the
14+
connection URI and credentials.
15+
16+
### Option 2: Load the schema and data into your own PostgreSQL server
17+
18+
If you already have a PostgreSQL server set up, you can import the schema and data used in this lab. Download the file
19+
[1-library-schema-and-data.sql](https://github.com/mongodb-developer/relational-migrator-lab/blob/main/docker/sample-postgres-library/init/1-library-schema-and-data.sql)
20+
file and load it using psql or [pgAdmin](https://www.pgadmin.org/download/).
21+
22+
### Option 3: Run a PostgreSQL container using Docker
23+
24+
If you don't have an existing PostgreSQL server but have Docker installed, you can easily load a container pre-configured with
25+
PostgreSQL and the sample database:
26+
27+
1. Clone or download the code from this lab's [Github repo](https://github.com/mongodb-developer/relational-migrator-lab).
28+
2. Open a terminal window and navigate to the repo root
29+
3. Build the Docker image by running the command:
30+
```
31+
docker build -f ./docker/sample-postgres-library/Dockerfile -t sample-postgres-library .
32+
```
33+
4. Start the Docker container by running the command:
34+
```
35+
docker run -p 5432:5432 sample-postgres-library
36+
```
37+
The PostgreSQL server can be accessed at localhost:5432 with a username of `postgres` and a password of `postgres`.
38+
39+
### Option 4: Load an SQL file
40+
Choose this option if you just want a quick hands-on experience and you don't need to run actual migration.
41+
Download the file [library-schema.sql](https://github.com/mongodb-developer/relational-migrator-lab/blob/main/resource/library-schema.sql)
42+
and upload this file to the Relational Migrator later, at the **create a project** step.
43+
44+
This is just the schema of the database, without actual data, so, you will not be able to perform an actual migration since you do not have a source database. But you can model the schema and play around with the Relational Migrator.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
sidebar_position: 20
3+
---
4+
5+
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
7+
# πŸ‘ MongoDB Database
8+
9+
As we'll be importing data from a Relational Database into MongoDB, you'll need to have a MongoDB database. You have a
10+
few options to set up this database.
11+
12+
### Option 1: New MongoDB Atlas cluster
13+
14+
The easiest way to run MongoDB is to use MongoDB Atlas, our cloud-hosted database offering.
15+
You can set a MongoDB Atlas account and a free forever M0 Cluster.
16+
17+
To get yours, follow the instructions on the [Intro Lab:](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/what-is-mongodb)
18+
- [Create your Account](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-account)
19+
- [Deploy a Database Cluster](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-cluster)
20+
21+
Be sure to [open up the cluster to allow connections from your local computer](https://www.mongodb.com/docs/guides/atlas/network-connections/#overview), and configure a database user with the readWriteAnyDatabase role.
22+
23+
### Option 2: Use an existing cluster
24+
25+
If you have an existing MongoDB Atlas, Enterprise or Community cluster, you can use it as the migration target. Make sure you
26+
know the URI for the cluster, and have a database user with the readWriteAnyDatabase role.
27+
28+
### Option 3: Run a MongoDB container using Docker
29+
30+
31+
If you don't have an existing PostgreSQL server but have Docker installed, you can easily load a container pre-configured with
32+
MongoDB by running the following command:
33+
34+
```
35+
docker run -p 27017:27017 mongo
36+
```
37+
38+
This will launch an empty MongoDB community cluster on localhost:27017, suitable to use for this lab.
39+
You can connect with no username or password. Since this command does not use Docker volumes, any data will be lost when the container is stopped.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
sidebar_position: 20
3+
---
4+
5+
import useBaseUrl from '@docusaurus/useBaseUrl';
6+
7+
# πŸ‘ MongoDB Relational Migrator
8+
9+
Download and install MongoDB Relational Migrator
10+
11+
Now you will need to go to the [MongoDB Relational Migrator downloads page](https://www.mongodb.com/try/download/relational-migrator), select your OS, download and install it. Once installed,
12+
run it and it will be running on a browser at http://127.0.0.1:8278/.
13+
14+
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/download-relational-migrator.png" alt="Screenshot of the download page for Relational Migrator" />
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"label": "πŸ‘ Prerequisites",
3+
"link": {
4+
"type": "generated-index",
5+
"description": "Prerare everything you need to complete this Lab."
6+
}
7+
}

β€Ždocs/50-Create a Project/50-create-new-project.mdxβ€Ž renamed to β€Ždocs/50-create-project/50-create-new-project.mdxβ€Ž

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ Ensure Relational Migrator is installed and running (normally at http://127.0.0.
1111

1212
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/50-image-001.png" alt="Screenshot of the connect modal" />
1313

14-
## Select an option
15-
1. Click **Connect to live database**
16-
2. Click **Load schema from a file** if you NOT have access to a source database.
14+
## Select one of the three options
15+
- Click **Connect to live database** if you are running the origin DB in the cloud, Docker or using your own hardware.
16+
- Click **Load schema from a file** if you don't have access to a source database and just want to work with the schema (you won't have any data to import though).
17+
- Click **Use a sample schema** to play around with a test schema, without any data. This does not require connecting to a real DB. We won't use this one in this Lab.
1718

1819
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/50-image-002.png" alt="Screenshot of the connect modal" />
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import Screenshot from "@site/src/components/Screenshot";
22

3-
# πŸ‘ Connect Database
3+
# πŸ‘ Connect to the Database
44

5-
## Select PostgreSQL as Database
5+
## Select PostgreSQL as Database Type
66

77
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/60-image-000.png" alt="Selecting PostgreSQL as Database" />
88

99
## Enter connection details
1010

1111
Enter the details for the PostgreSQL database you will be migrating from.
1212

13-
- If your instructor has configured a server for you to use, ask them for the host name, username and password.
13+
- If your instructors have configured a server for you to use, ask them for the host name, username and password. It's important to click on the `SSL` tab and active SSL.
1414
- If you followed the steps to configure PostgreSQL in a docker container, the hostname will be `localhost`, username `postgres` and password `postgres`.
1515

16-
Click Test Connection to ensure your details are correct.
16+
Click `Test Connection` to ensure your details are correct.
1717

18-
Click Connect to proceed to the next step.
18+
Click `Connect` to proceed to the next step.
1919

2020
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/60-image-001.png" alt="Screenshot of the connect modal" />

β€Ždocs/50-Create a Project/70-select-tables.mdxβ€Ž renamed to β€Ždocs/50-create-project/70-select-tables.mdxβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ import Screenshot from "@site/src/components/Screenshot";
22

33
# πŸ‘ Select Tables
44

5-
We want to migrate data from all of the tables, so check all of them and then click Next.
5+
We want to migrate data from all of the tables, so check all of them and then click `Next`.
66

77
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/70-image-001.png" alt="Screenshot of the connect modal" />
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import Screenshot from "@site/src/components/Screenshot";
22

3-
# πŸ‘ Define Initial Schema
3+
# πŸ‘ Define the Initial Schema
44

55
Relational Migrator gives you three options on how your MongoDB schema should be created. Regardless of which option you choose,
66
you can manually modify your schema later.
77

8-
Select β€œStart with a recommended MongoDB schema”
8+
Select `Start with a recommended MongoDB schema`
99

1010
You are asked which of the tables should represented as a collection in MongoDB.
1111

12-
Select the five collections that we want:
12+
Select the five collections that we want as they are the main Entities in our schema.
1313

1414
- authors
1515
- books
@@ -21,4 +21,4 @@ Any tables you did not check will be embedded in other collections.
2121

2222
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/80-image-001.png" alt="Screenshot of the connect modal" />
2323

24-
- Click Next, then give your project a name.
24+
Click `Next`, then give your project a name.

0 commit comments

Comments
Β (0)