Skip to content

Commit 9f5384c

Browse files
committed
Added laptop doc
1 parent cdfcb5d commit 9f5384c

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

docs/self-hosted/laptop.md

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
# Offline Laptop
6+
7+
In this guide we will get Resgrid up in running via Docker Compose for local (single user) use on a Windows computer.
8+
9+
## Use Case
10+
11+
This setup is intended to get Resgrid up and running on a single-user environment, like a laptop that will not be connected to or have internet access. No external users (i.e. from another machine or mobile device) will be connecting to this installation. For example you are coordinate rescue and recovery efforts for a hurricane from a location on your laptop, you are communicate with your field teams only via a radio as there is no power or cell phone data/WiFi Internet.
12+
13+
## System Requirements
14+
15+
1.) Windows 10 or Windows 11 Laptop with WSL2 (Windows Subsystem for Linux)
16+
2.) Docker Desktop with WSL2 Enabled
17+
3.) Enough HDD Space to handle Mapping Data (if you want a large region like North America you'll need 30+ GB)
18+
4.) 4 or more Core Processor
19+
5.) 16GB or more of RAM
20+
21+
## Setup Notice
22+
23+
There is no redundancy, backup or fail-over in this setup. Everything runs on the local computer and is not intended to be accessed by anyone off of the local computer. If the local computer gets damaged this could result in loss of data. It's recommend that you have a USB drive that you can backup the database to (ideally the whole resgrid directory) periodically during the operation.
24+
25+
## Prerequisites & Dependencies
26+
27+
1. Update Windows
28+
2. Install WSL2 and Ubuntu 22.04 <https://documentation.ubuntu.com/wsl/en/latest/guides/install-ubuntu-wsl2/>
29+
3. Open up your Ubuntu 22.04 instance and finalize the setup (set password).
30+
4. Install Docker <https://docs.docker.com/desktop/wsl/> and enable WSL2 backend.
31+
32+
## Docker Compose Setup
33+
34+
1. Open Notepad as Administrator and open C:\Windows\System32\drivers\etc\hosts file.
35+
36+
2. Add the following lines to the hosts file and save.
37+
```
38+
127.0.0.1 rg.mylocal
39+
127.0.0.1 rgapi.mylocal
40+
127.0.0.1 rgevents.mylocal
41+
127.0.0.1 rgtile.mylocal
42+
```
43+
44+
If you get a permissions error you didn't open up Notepad as Administrator, also don't use any RichText editor (Wordpad, Word, etc).
45+
46+
3. Navigate to Geofabrik <https://download.geofabrik.de/> and download the .osm.pbf file the region you will be operating in.
47+
48+
It is not recommend to try and pull an entire Sub Region (i.e. North America) as that will take quite a long time to import into the database. Instead it's recommended to import and additional Sub (Sub) Region, like a US State (i.e. Florida) or a Special Sub Region if they are available (i.e. US South).
49+
50+
4. Using the Windows File Explorer move the osm.pbf file into Linux (left side bar) Ubuntu-22.04, home and your username folder. This will put it in your home directory.
51+
52+
5. Start your Ubuntu-22.04 WSL2 Instance so the command prompt is visible.
53+
54+
6. Clone the setup scripts for the Laptop compose:
55+
56+
```bash
57+
git clone https://github.com/Resgrid/resgrid-setup.git -b laptop resgrid
58+
```
59+
60+
You should now have a folder called resgrid in your current directory.
61+
62+
7. Open the resgrid directory:
63+
64+
```bash
65+
cd resgrid
66+
```
67+
68+
8. Import the osm.pbf you downloaded and placed in your home directory into the tile server. Change /home/yourname/yourregion.osm.pbf in the command below to the correct home directory name (yourname) and the name of the region file you downloaded (yourregion).
69+
70+
```bash
71+
docker run \
72+
-v /home/yourname/yourregion.osm.pbf:/data/region.osm.pbf \
73+
-v osm-data:/docker-data/osm/ \
74+
overv/openstreetmap-tile-server \
75+
import
76+
```
77+
78+
If the container exits without errors, then your data has been successfully imported and you are now ready to run the tile server. If you selected a very large region, like North America this process can take days.
79+
80+
81+
## Run the Docker Compose
82+
83+
Once you have setup the environment variables you can now run the docker compose file in the resgrid directory:
84+
85+
```bash
86+
docker compose up
87+
```
88+
89+
That will run the interactive version of the containers, Ctrl+C will stop the containers.
90+
91+
If you want to run the containers in the background, use the -d option:
92+
93+
```bash
94+
docker compose up -d
95+
```
96+
97+
The Resgrid system will take about 5 minutes to start up fully, this is due to the startup order of the containers. The last container to startup will be the web container, once that one is ready, you can now access the system.
98+
99+
100+
## Initial Web Login
101+
102+
Open up your web browser and navigate to **https://rg.mylocal**, **https://rgapi.mylocal**, **https://rgevents.mylocal** and **https://rgtile.mylocal**. You will need to accept the self-signed cert for each url and add exceptions in the browsers. You can follow this guide <https://it.nmu.edu/docs/adding-security-exception-your-browser> to add those exceptions.
103+
104+
Once you have completed the steps above you will be able to log into the web applications user interface. Open up a web browser and navigate to **https://rg.mylocal**, you will then be prompted by the login screen. Your default administrator credentials are **admin/changeme1234**. Once you log into the system it’s recommended that you change your admin password from the Edit Profile page by clicking on the Administrator name in the upper left hand corner.
105+
106+
## Updating
107+
108+
To update Resgrid you'll need to stop the system, clear the current containers and restart.
109+
110+
Stop all running containers.
111+
112+
```bash
113+
docker compose down
114+
```
115+
116+
Remove all cached images (to ensure we get new ones).
117+
118+
```bash
119+
docker rmi -f $(docker images -aq)
120+
```
121+
122+
Restart the containers and they will pull new containers.
123+
124+
```bash
125+
docker compose up -d
126+
```
127+
128+
## What's Next?
129+
130+
This Quick Start gets the system running via local host, but not externally or within your network. You will need to create DNS entries in your internal or external DNS server to point to the server that is running the containers. It's also recommend you change some default values in the resgrid.env file to ensure proper security.

0 commit comments

Comments
 (0)