|
| 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 | + |
0 commit comments