Skip to content

Commit 4e7fccc

Browse files
committedDec 11, 2020
Add a README for Vagrant
1 parent 41689a2 commit 4e7fccc

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed
 

‎README-Vagrant.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Vagrant README
2+
3+
<!-- vim-markdown-toc GFM -->
4+
5+
* [Getting Started](#getting-started)
6+
* [Building Your Vagrant VM](#building-your-vagrant-vm)
7+
* [Logging in to Your VM](#logging-in-to-your-vm)
8+
* [Inspecting Your Database](#inspecting-your-database)
9+
* [Refactoring Your Code](#refactoring-your-code)
10+
* [Re-creating the database](#re-creating-the-database)
11+
12+
<!-- vim-markdown-toc -->
13+
14+
## Getting Started
15+
16+
A `Vagrantfile` has been provided in order to make this code more convenient to
17+
run. To get started via `Vagrant`, you'll need:
18+
19+
* A working `Vagrant` environment
20+
* A `git checkout` of this repository
21+
* A copy of `GeoLite2-Country.mmdb` in the root of this repository
22+
23+
## Building Your Vagrant VM
24+
25+
After you have checked out this repository and added a `GeoLite2-Country.mmdb` to
26+
the root directory of the repository, run this command from the root directory.
27+
28+
```bash
29+
vagrant up
30+
```
31+
32+
## Logging in to Your VM
33+
34+
This will build your Vagrant VM, build your `Go` code and also run the example
35+
code for you. To log in to your container, run this command:.
36+
37+
```bash
38+
vagrant ssh
39+
cd /vagrant
40+
```
41+
42+
## Inspecting Your Database
43+
44+
Once you have logged in, you can test out your freshly created database:
45+
46+
```bash
47+
mmdbinspect -db GeoLite2-Country.mmdb \
48+
-db GeoLite2-Country-with-Department-Data.mmdb \
49+
56.0.0.1 56.1.0.0/24 56.2.0.54 56.3.0.1 | less
50+
```
51+
52+
## Refactoring Your Code
53+
54+
You can now freely edit the code outside of the Vagrant VM and re-run it from
55+
inside the VM.
56+
57+
### Re-creating the database
58+
59+
After you have edited the files, log in to your VM using the instructions above
60+
and run the following code:
61+
62+
```bash
63+
go build && ./mmdb-from-go-blogpost
64+
```

‎README.md

+6
Original file line numberDiff line numberDiff line change
@@ -184,4 +184,10 @@ The [output](https://gist.github.com/nchelluri/ad079300b92a634bc4b36249b77f3893)
184184

185185
And that's it! You've now built yourself a GeoLite2 Country MMDB file enriched with custom data.
186186

187+
### Using Docker or Vagrant
188+
189+
The code repository comes with a [Dockerfile](https://github.com/maxmind/mmdb-from-go-blogpost/blob/master/Dockerfile) and a [Vagrantfile](https://github.com/maxmind/mmdb-from-go-blogpost/blob/master/Vagrantfile) included. If you'd like to begin work in an environment which has all of the necessary software dependencies pre-installed, see our documentation for getting started with [Docker](https://github.com/maxmind/mmdb-from-go-blogpost/blob/master/README-Docker.md) and [Vagrant](https://github.com/maxmind/mmdb-from-go-blogpost/blob/master/README-Vagrant.md).
190+
191+
### Contacting Us
192+
187193
Feel free to open an issue in the [repo](https://github.com/maxmind/mmdb-from-go-blogpost/issues) if you have any questions or just want to tell us what you've created.

0 commit comments

Comments
 (0)