Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: Nip.io wildcard dns #89

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions docs/deployment/configuration/dnsmasq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: DNSMASQ - Ubuntu18.04
sidebar_label: DNSMasq
description: Manage your Onepanel deployment using dnsmasq
---

:::caution
This will temporarily break your internet
:::

1. To use dnsmasq we'll need to first disable Ubuntu’s resolver service.
```bash
sudo systemctl stop systemd-resolved
```
2. We’re going to edit /etc/resolv.conf, so we'll back it up
```bash
sudo cp /etc/resolv.conf /etc/resolv.conf.bk
```
3. Then, set Googles DNS server for our use.
```bash
shell script echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf
```
4. Your internet should work at this point. Run `sudo apt update` Then install dnsmasq
```bash
sudo apt install dnsmasq
```
5. Next, we want to pick a domain name. In this case, we’ll use dnsmasq, add this value to your /etc/hosts file.
```bash
sudo nano /etc/hosts
```
Add:
```
127.0.0.1 dnsmasq
# Other values
```
Then save the file.
6. Then, we want to edit dnsmasq.conf file, make sure to back it up before editing.
```bash
sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.bk
sudo nano /etc/dnsmasq.conf
```
7. Assuming our web-url we want accessible, from our dnsmasq, is `onepanel.lan` and all the subdomains, such as `waffles.onepanel.lan`, or `app.onepanel.lan`
We need the IP address of onepanel.lan , which is `52.142.34.187` for our guide
You want the following values to be set:

port=53
domain-needed
bogus-priv
strict-order
expand-hosts
#IMPORTANT TO MATCH YOUR /etc/hosts value!
domain=dnsmasq
#IP ADDRESS MAY NEED TO BE LOOKED UP FIRST
address=/onepanel.lan/52.142.34.187

You may have to run the find command to find these places to update. - Or you can start with a blank conf file and just add those values in.

8. Finally, we are almost ready to use dnsmasq.
Add one more nameserver.
`sudo nano /etc/resolve.conf`

nameserver 127.0.0.1
nameserver 8.8.8.8

:::important
Note the order of the nameservers. This is **IMPORTANT**.
We are instructing DNSMasq the order to check in.
:::
Finally, run
```bash
sudo dnsmasq
```
Then, you can test out in your CLI or Browser.
```bash
dig onepanel.lan
dig loc.onepanel.lan
or
dig waffles.onepanel.lan
```
The server should return *127.0.0.1#53*

If you load it in the browser, you’ll get a 404 if the sub-domain has no content it can serve up. - But not a failure to look up Domain
12 changes: 12 additions & 0 deletions docs/deployment/configuration/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ artifactRepository:

And example Minio configuration:

#### Azure Minio Webapp
```yaml
artifactRepository:
s3:
Expand All @@ -270,6 +271,17 @@ artifactRepository:
secretKey: 5bEYu26084qjSFyclM/f2pz4gviSfoOg+mFwBH39
```

#### Local Minio Server
```yaml
artifactRepository:
s3:
accessKey: AKIAIOSFODNN7EXAMPLE
bucket: my-bucket
endpoint: f67f39e6b94d.ngrok.io
region: us-west-2
secretKey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
```

<!-- ```yaml
artifactRepository:
gcs:
Expand Down
153 changes: 153 additions & 0 deletions docs/deployment/configuration/minio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
---
title: Minio
sidebar_label: Minio
description: Onepanel deployment with MinIO
---

MinIO is an object storage server that exposes S3-compatible APIs and it has a gateway feature that allows proxying requests to Azure Blob Storage. To setup our gateway, we will make use of Azure’s Web App on Linux.

To get started, make sure you have installed Azure CLI and you are logged in (az login). Proceed to create a Resource group, if you don’t have one already:

```shell
az group create --name "<group-name>" --location "<location>"
```

## Storage Account

Create a Storage account in your resource group, the name of the storage account must be globally unique:

```shell
az storage account create \
--name "<storage-name>" \
--kind BlobStorage \
--sku Standard_LRS \
--access-tier Cool \
--resource-group "<resource-group>" \
--location "<location>"
```

Retrieve the account key for the storage account:

```shell
az storage account show-connection-string \
--name "<storage-name>" \
--resource-group "<resource-group>"
```

The output should be in the format:

```json
{
"connectionString": "DefaultEndpointsProtocol=https;EndpointSuffix=core.windows.net;AccountName=gitlab-azure-minio-storage;AccountKey=h0tSyeTebs+..."
}
```

## Deploy MinIO to Web App on Linux

First, we need to create an App Service Plan in the same resource group.

```shell
az appservice plan create \
--name "<app-plan-name>" \
--is-linux \
--sku B1 \
--resource-group "<resource-group>" \
--location "<location>"
```

Create a Web app configured with the minio/minio Docker container, the name you specify will be used in the URL of the web app:

```shell
az webapp create \
--name "<app-name>" \
--deployment-container-image-name "minio/minio" \
--plan "<app-plan-name>" \
--resource-group "<resource-group>"
```

The Web app should now be accessible at https://gitlab-minio-app.azurewebsites.net.

Lastly, we need to set up the startup command and create environment variables that will store our storage account name and key for use by the web app, MINIO_ACCESS_KEY & MINIO_SECRET_KEY.

```shell
az webapp config appsettings set \
--settings "MINIO_ACCESS_KEY=<storage-name>" "MINIO_SECRET_KEY=<secret-key>" "PORT=9000" \
--name "<app-name>" \
--resource-group "<resource-group>"

# Startup command
az webapp config set \
--startup-file "gateway azure" \
--name "<app-name>" \
--resource-group "<resource-group>"
```

## Conclusion

You can proceed to use this gateway with any client with s3-compability. Your webapp URL will be the **s3 endpoint**, storage account name will be your **accesskey**, and storage account key will be your **secretkey**.

This guide was adapted for posterity from [Alessandro Segala’s blog post on same topic](https://withblue.ink/2017/10/29/how-to-use-s3cmd-and-any-other-amazon-s3-compatible-app-with-azure-blob-storage.html).

# LOCAL SERVER DEPLOYMENT

In this guide, we'll deploy Onepanel using a local Minio server.

## Installation

First install Minio using Docker, or visit [Minio](https://docs.min.io/docs/minio-quickstart-guide.html) for your preferred installation process

```shell
docker run -p 9000:9000 \
-e "MINIO_ACCESS_KEY=AKIAIOSFODNN7EXAMPLE" \
-e "MINIO_SECRET_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" \
-e "MINIO_REGION_NAME=us-west-2"
minio/minio server /mnt/data
```
```shell
Attempting encryption of all config, IAM users and policies on MinIO backend
Endpoint: http://172.17.0.2:9000 http://127.0.0.1:9000
Browser Access:
http://172.17.0.2:9000 http://127.0.0.1:9000
Object API (Amazon S3 compatible):
Go: https://docs.min.io/docs/golang-client-quickstart-guide
Java: https://docs.min.io/docs/java-client-quickstart-guide
Python: https://docs.min.io/docs/python-client-quickstart-guide
JavaScript: https://docs.min.io/docs/javascript-client-quickstart-guide
.NET: https://docs.min.io/docs/dotnet-client-quickstart-guide
```

Once your server's running, you'll need to set port for Minio server to public so kubectl can sync all FTPs into your local Minio server.
To do this we'll use [Ngrok](https://ngrok.com/), this tool exposes local servers behind NATs and firewalls to the public internet over secured tunnels.

Open a separate terminal and install
```shell
snap install ngrok
```
then, confirm installation by running
```shell
ngrok version
```
once installation is complete, you can immediately start tunneling your local server
```shell
ngrok http 9000
```
```shell
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 7 hours, 34 minutes
Version 2.3.35
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://f67f39e6b94d.ngrok.io -> http://localhost:9000
Forwarding https://f67f39e6b94d.ngrok.io -> http://localhost:9000
Connections ttl opn rt1 rt5 p50 p90
17 6 0.04 0.01 300.48 686.52
```
:::note
copy forwarding tunnel to use for onepanel configurations, in this example it's `http://f67f39e6b94d.ngrok.io`
:::
:::caution
Ngrok exposes your Minio server in public! make sure to keep the tunnel information secured or add authentication by visiting their [website](https://ngrok.com/)
:::

Once everything is set up go to [configurations](./files.md#local-server) guide for `params.yaml`, once completed run `opctl apply` and deploy with local Minio server
32 changes: 32 additions & 0 deletions docs/deployment/configuration/nipio.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: NIP.IO
sidebar_label: Nipio
description: Simple wildcard DNS for any IP Address.
---

NIP.IO is powered by [PowerDNS](https://powerdns.com/) with a simple, custom [PipeBackend](https://doc.powerdns.com/authoritative/backends/pipe.html): [backend.py](https://github.com/exentriquesolutions/nip.io/blob/master/nipio/backend.py)

## Setup
To deploy Onepanel's wildcard dns with nipio, you have to add some placeholder domain to your `params.yaml` first:
```yaml
domain: domain.com
fqdn: app.domain.com
```
then, do `opctl apply` which will give you an ip address that hosts onepanel:
```bash
In your DNS, add an A record for domain.com and point it to '20.62.148.118'
Once complete, your application will be running at http://app.domain.com
```

and then, when you get the IP address, plug it back into params.yaml as domain and fqdn and use `nip.io` as your service host:
```yaml
domain: 20.62.148.118.nip.io
fqdn: app.20.62.148.118.nip.io
```

run `opctl apply` once more to redeploy the new configuration, once complete it'll provide you an updated url with the `nip.io` domain, copy/paste it into your browser and it should redirect you to Onepanel's login page.

Use the following command to get your auth token to log into Onepanel:
```bash
opctl auth token
```
2 changes: 2 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ module.exports = {
'deployment/configuration/cli',
'deployment/configuration/files',
'deployment/configuration/tls',
'deployment/configuration/minio',
'deployment/configuration/nipio',
]
},
{
Expand Down