Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
, and an empty message aborts the commit.
  • Loading branch information
pnedkov committed Jan 29, 2024
1 parent 490e953 commit 3b8a2aa
Showing 1 changed file with 89 additions and 84 deletions.
173 changes: 89 additions & 84 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,84 @@

---

<details>
<summary>

## TL;DR

</summary>

- Run as a stand-alone container

```sh
docker run -d -p 8080:8080 prestigen/ipask
```

- Run with nginx reverse proxy

```sh
git clone https://github.com/pnedkov/ipask.git
cd ipask/
CN=yordomain.com ./resources/generate_cert.sh
docker compose -f docker-compose.yaml up -d
```

</details>

---

<details>
<summary>

## Getting started
## Usage

</summary>

- If `ipask` is running as a stand-alone application on the default port `8080`:

```sh
$ curl <host>:8080
$ wget -qO - <host>:8080
```

Or navigate to `http://<host>:8080` from your browser.

- If `ipask` is running with nginx reverse proxy:

```sh
$ curl -kL <host>
$ wget --no-check-certificate -qO - <host>
```

Or navigate to `<host>` from your browser. It will automatically redirect to https.

- Available URL paths:
| Path | Alias | Description |
| --- | --- | --- |
| `/ip` | | IP address |
| `/host` | `/h` | Hostname or FQDN (if `REVERSE_DNS_LOOKUP` is enabled) |
| `/xff` | | X-Forwarded-For header |
| `/city` | `/ci` | City (if `GEOIP` is enabled) |
| `/region` | `/reg` | Region (if `GEOIP` is enabled) |
| `/country` | `/co` | Country (if `GEOIP` is enabled) |
| `/location` | `/loc` | GPS Coordinates (if `GEOIP` is enabled) |
| `/ua` | | User-Agent request header |
| `/headers` | `/he` | All headers |
| `/version` | `/ver` | Application version (commit hash) |

</details>

---

<details>
<summary>

## Run from the source code

</summary>

### Prerequisites

- Install Git and Python:

```
Expand Down Expand Up @@ -54,23 +125,14 @@
curl -L git.io/GeoLite2-City.mmdb -o resources/GeoLite2-City.mmdb
```
</details>
---
<details>
<summary>
## Run from the source code
</summary>
- Environment variables:
| Environment variable | Default value |
| --- | --- |
| GEOIP | `false` |
| REVERSE_DNS_LOOKUP | `false` |
### Run
- Run using `run.py`:
```sh
Expand Down Expand Up @@ -111,17 +173,21 @@
<details>
<summary>

## Run in a stand-alone container
## Build and run in a container

</summary>

- Prerequisites:
### Prerequisites:

```sh
sudo pacman -S docker docker-compose docker-buildx
sudo usermod -aG docker $USER
sudo systemctl enable --now docker.service
```
```sh
sudo pacman -S git docker docker-compose docker-buildx
sudo usermod -aG docker $USER
sudo systemctl enable --now docker.service
git clone https://github.com/pnedkov/ipask.git
cd ipask/
```

### Build and run as a stand-alone container

- Build:

Expand All @@ -134,79 +200,18 @@
docker run -d -p 8080:8080 ipask
```

</details>
### Build and run with Docker Compose behind nginx reverse proxy

---
- Generate a self-signed test key-pair utilized by nginx

<details>
<summary>

## Run with Docker Compose behind nginx reverse proxy

</summary>
* Generate a self-signed test key-pair utilized by the nginx reverse proxy.

Review the environment variables inside `resources/generate_cert.sh` and set them accordingly.
For example:
```sh
CN=yourdomain.com ./resources/generate_cert.sh
```
Or you could use your own key and certificate. `docker-compose.yaml` expects to find them here:
- $HOME/.nginx/key.pem
- $HOME/.nginx/cert.pem

- (Option A): Pull the latest container version from hub.docker.com and run it:
```sh
docker compose -f docker-compose.yaml up -d
```
- (Option B): Build the container from the source and run it:
```sh
docker compose up -d
```
Use the `--build` option in order to force the build process in case you already have the `ipask` container and want a new one.

</details>

---

<details>
<summary>

## Usage

</summary>

- If running `ipask` as a stand-alone application:

```sh
$ curl <host>:8080
$ wget -qO - <host>:8080
```

Or navigate to `http://<host>:8080` from your browser.

- If runing `ipask` with nginx reverse proxy:
- Build and run

```sh
$ curl -kL <host>
$ wget --no-check-certificate -qO - <host>
docker compose up -d
```

Or navigate to `<host>` from your browser. It will automatically redirect to https.

- Available URL paths:
| Path | Alias | Description |
| --- | --- | --- |
| `/ip` | | IP address |
| `/host` | `/h` | Hostname or FQDN (if `REVERSE_DNS_LOOKUP` is enabled) |
| `/xff` | | X-Forwarded-For header |
| `/city` | `/ci` | City (if `GEOIP` is enabled) |
| `/region` | `/reg` | Region (if `GEOIP` is enabled) |
| `/country` | `/co` | Country (if `GEOIP` is enabled) |
| `/location` | `/loc` | GPS Coordinates (if `GEOIP` is enabled) |
| `/ua` | | User-Agent request header |
| `/headers` | `/he` | All headers |
| `/version` | `/ver` | Application version (commit hash) |

</details>

0 comments on commit 3b8a2aa

Please sign in to comment.