Skip to content

Commit 7a7e14f

Browse files
modifying setup options
1 parent c4d93cb commit 7a7e14f

File tree

12 files changed

+217
-190
lines changed

12 files changed

+217
-190
lines changed
File renamed without changes.
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import Screenshot from "@site/src/components/Screenshot";
2+
3+
# 👐 Setup
4+
5+
## GitHub Codespaces
6+
7+
You will be working in GitHub Codespaces throughout this lab. A codespace is a cloud-hosted, containerized development environment that comes pre-configured with all the tools you need to run this lab.
8+
9+
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/rm-lab?quickstart=1) link. You will be prompted to sign into GitHub if you haven't already. Once signed in, click the **Create new codespace** button to create a new codespace.
10+
11+
<Screenshot url="https://github.com/codespaces" src="img/10-dev-env/1-create-codespace.png" alt="Start a codespace" />
12+
13+
Let it run for a few minutes as it prepares a Docker container with all the required libraries and a MongoDB cluster.
14+
15+
**That's it! You're ready for the lab!**
16+
17+
:::caution
18+
During the lab, we will use GitHub Codespaces. The following instructions are here just in case you can't use Codespaces or if you really, really, really want a local installation.
19+
:::
20+
21+
22+
<details>
23+
<summary>🦹 __Run this lab locally__</summary>
24+
#
25+
# 1. MongoDB Database
26+
27+
As we'll be importing data from a Relational Database into MongoDB, you'll need to have a MongoDB database. You have a
28+
few options to set up this database.
29+
30+
## 🦸 Option A: New MongoDB Atlas cluster
31+
32+
The easiest way to run MongoDB is to use MongoDB Atlas, our cloud-hosted database offering.
33+
You can set a MongoDB Atlas account and a free forever M0 Cluster.
34+
35+
To get yours, follow the instructions on the [Intro Lab:](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/what-is-mongodb)
36+
- [Create your Account](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-account)
37+
- [Deploy a Database Cluster](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-cluster)
38+
39+
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.
40+
41+
42+
## 🦸 Option B: Use an existing cluster
43+
44+
If you have an existing MongoDB Atlas, Enterprise or Community cluster, you can use it as the migration target. Make sure you
45+
know the URI for the cluster, and have a database user with the readWriteAnyDatabase role.
46+
47+
## 🦸 Option C: Run a MongoDB container using Docker
48+
49+
50+
If you don't have an existing MongoDB server but have Docker installed, you can easily load a container pre-configured with
51+
MongoDB by running the following command:
52+
53+
```
54+
docker run -p 27017:27017 mongo
55+
```
56+
57+
This will launch an empty MongoDB community cluster on localhost:27017, suitable to use for this lab.
58+
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.
59+
60+
61+
# 2. MongoDB Relational Migrator
62+
63+
Download and install MongoDB Relational Migrator.
64+
65+
- Go to the [MongoDB Relational Migrator downloads page](https://www.mongodb.com/try/download/relational-migrator), select your OS and download it
66+
- Install the MongoDB Relational Migrator
67+
- Start it
68+
- It should open a browser at the address http://127.0.0.1:8278/
69+
70+
<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" />
71+
72+
---
73+
74+
There are more advanced ways to install the MongoDB Relational Migrator. You can check them out in [the installation docs page](https://www.mongodb.com/docs/relational-migrator/installation/). These won't be covered during this Lab.
75+
76+
</details>
77+
78+
79+
80+

docs/10-dev-env/10-postgres.mdx

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
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.
10+
11+
## 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 connection URI and credentials.
14+
15+
:::caution
16+
In an intructor-led lab you will use the provisioned PostgreSQL database, no need to do anything else.
17+
:::
18+
19+
<details>
20+
<summary>🦹 __Other database options__</summary>
21+
22+
## 🦸 Option A: Load the schema and data into your own PostgreSQL server
23+
24+
If you already have a PostgreSQL server set up, you can import the schema and data used in this lab. Download the file
25+
[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)
26+
and load it using [psql](https://www.postgresql.org/docs/10/app-psql.html) or [pgAdmin](https://www.pgadmin.org/download/).
27+
28+
## 🦸 Option B: Run a PostgreSQL container using Docker
29+
30+
If you don't have an existing PostgreSQL server but have Docker installed, you can easily load a container pre-configured with
31+
PostgreSQL and the sample database:
32+
33+
1. Clone or download the code from this lab's [Github repo](https://github.com/mongodb-developer/relational-migrator-lab).
34+
2. Open a terminal window and navigate to the repo root.
35+
3. Build the Docker image by running the command:
36+
```sh
37+
docker build -f ./docker/sample-postgres-library/Dockerfile -t sample-postgres-library .
38+
```
39+
4. Start the Docker container by running the command:
40+
```
41+
docker run -p 5432:5432 sample-postgres-library
42+
```
43+
The PostgreSQL server can be accessed at localhost:5432 with a username of `postgres` and a password of `postgres`.
44+
45+
## 🦸 Option C: Load a SQL file
46+
Choose this option if you just want a quick hands-on experience and you don't need to run an actual migration.
47+
Download the file [library-schema.sql](https://github.com/mongodb-developer/relational-migrator-lab/blob/main/resource/library-schema.sql)
48+
and upload this file to the Relational Migrator later, at the [create a project](/docs/category/-create-a-project) step.
49+
50+
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.
51+
52+
</details>

docs/10-dev-env/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Dev Environment",
3+
"position": 10,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Setup the dev environment and prerequisites"
7+
}
8+
}

docs/20-prerequisites/10-postgres.mdx

Lines changed: 0 additions & 47 deletions
This file was deleted.

docs/20-prerequisites/20-mongodb.mdx

Lines changed: 0 additions & 43 deletions
This file was deleted.

docs/20-prerequisites/30-relational-migrator.mdx

Lines changed: 0 additions & 22 deletions
This file was deleted.

docs/20-prerequisites/_category_.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/50-create-project/50-create-new-project.mdx

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

33
# 👐 Creating a New Project
44

5-
Ensure the Relational Migrator is installed and running (usually at http://127.0.0.1:8278/).
6-
5+
Ensure the Relational Migrator is installed and running (in your codespace or locally at http://127.0.0.1:8278/).
76

87

98
## Click on New Project

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const config = {
8484
title: `${title}`,
8585
tagline: `${tagLine}`,
8686
url: `https://${workshopName}.github.io`,
87-
baseUrl: `/${workshopName}/`,
87+
baseUrl: `/`,
8888
projectName: `${organizationName}.github.io`,
8989
organizationName: `${organizationName}`,
9090
trailingSlash: false,

0 commit comments

Comments
 (0)