Hello all.
I have been using the things stack that I deployed on AWS for a few years now without any problems.
I now would like to remove the cost of AWS, and host myself. I get TTS setup much in the same way that I did on aws using docker without much issue, though while hosting myself, I need to use a reverse proxy. To the best of my knowledge this process went smooth and without issue. The entire setup probably took somewhere between 15-20 minutes.
I removed 2 of my gateways from AWS and connected them to my local instance and they do seem to be connected correctly:
Here is where things get a bit strange:
This is an image of what I see after sitting on the gateway page for abuot 5 minutes. the âLast seenâ counter keeps resetting, however I do not see any data. very strange.
Then If I connect my computer via VPN to the network that the server hosting TTS is on, i see this:
we have data!
but⌠why are we not seeing data without the VPN? Could be a port issue?
Here is the data from the gateway message:
IP Address 10.0.1.69 is the address of the gateway running on the same network as the server.
Here is data from the 2nd gateway:
That gatewayâs IP address is elsewhere on the internet and I see the same stuff, I can view data when on the VPN, but see nothing other than the couner reset when not. This makes me think again that it is a port issue.
the interesting thing is that the gateway does show a device that has sent data, however that device data never makes it to the application that it is registered within.
Here is my nginx reverseProxy config, it is very simple:
server {
listen 443 ssl;
server_name <website name here!!!>
location / {
proxy_pass http://10.0.1.10;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
and my docker compose file:
version: â3.7â
services:postgres:
# In production, replace âlatestâ with tag from Docker
image: postgres:latest
restart: unless-stopped
environment:
- POSTGRES_PASSWORD=root
- POSTGRES_USER=root
- POSTGRES_DB=ttn_lorawan
volumes:
- ${DEV_DATA_DIR:-.env/data}/postgres:/var/lib/postgresql/data
ports:
- â127.0.0.1:5432:5432âredis:
# In production, replace âlatestâ with tag from Docker
image: redis:latest
command: redis-server --appendonly yes
restart: unless-stopped
volumes:
- ${DEV_DATA_DIR:-.env/data}/redis:/data
ports:
- â127.0.0.1:6379:6379âstack:
# In production, replace âlatestâ with tag from Docker
image: thethingsnetwork/lorawan-stack:latest
entrypoint: ttn-lw-stack -c /config/ttn-lw-stack-docker.yml
command: start
restart: unless-stopped
depends_on:
- redis
- postgres
volumes:
- ./blob:/srv/ttn-lorawan/public/blob
- ./config/stack:/config:ro
- ./public:/public:ro
# If using Letâs Encrypt:
#- ./acme:/var/lib/acme
environment:
TTN_LW_BLOB_LOCAL_DIRECTORY: /srv/ttn-lorawan/public/blob
TTN_LW_REDIS_ADDRESS: redis:6379
TTN_LW_IS_DATABASE_URI: postgres://root:root@postgres:5432/ttn_lorawan?sslmode=disableports: # If deploying on a public server: - "80:1885" - "443:8885" - "1881:1881" - "8881:8881" - "1882:1882" - "8882:8882" - "1883:1883" - "8883:8883" - "1884:1884" - "8884:8884" - "1885:1885" - "8885:8885" - "1886:1886" - "8886:8886" - "1887:1887" - "8887:8887" - "1700:1700/udp" # If using custom certificates: secrets: - ca.pem - cert.pem - key.pem
If using custom certificates:
secrets:
ca.pem:
file: ./ca.pem
cert.pem:
file: ./cert.pem
key.pem:
file: ./key.pem
and here is my ttn-lw-stack-docker file:
Identity Server configuration
Email configuration for âlorawan-01.MY DOMAIN NAMEâ
is:
email:
sender-name: âSECRETâ
sender-address: ânoreply@lorawan-01.MY DOMAIN NAMEâ
network:
name: ânetworkâ
console-url: âhttps://lorawan-01.MY DOMAIN NAME/consoleâ
identity-server-url: âhttps://lorawan-01.MY DOMAIN NAME/oauthâ# If sending email with Sendgrid # provider: sendgrid # sendgrid: # api-key: '...' # enter Sendgrid API key # If sending email with SMTP # provider: smtp smtp: address: 'smtp.office365.com' # enter SMTP server address username: 'kevin@MY DOMAIN NAME' # enter SMTP server username password: 'SECRET' # enter SMTP server password
Web UI configuration for âlorawan-01.MY DOMAIN NAMEâ:
oauth:
ui:
canonical-url: âhttps://lorawan-01.MY DOMAIN NAME/oauthâ
is:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3âHTTP server configuration
http:
cookie:
block-key: âsecretâ # generate 32 bytes (openssl rand -hex 32)
hash-key: âsecretâ # generate 64 bytes (openssl rand -hex 64)
metrics:
password: âcropwatch_metrics_HfHSQz4jYCnTRVhYâ # choose a password
pprof:
password: âcropwatch_pprof_g4exjSfkmIzsLRQrâ # choose a passwordIf using custom certificates:
tls:
source: file
root-ca: /run/secrets/ca.pem
certificate: /run/secrets/cert.pem
key: /run/secrets/key.pemLetâs encrypt for âlorawan-01.MY DOMAIN NAMEâ
tls:
source: âacmeâ
acme:
dir: â/var/lib/acmeâ
email: âkevin@MY DOMAIN NAMEâ
hosts: [âlorawan-01.MY DOMAIN NAMEâ]
default-host: âlorawan-01.MY DOMAIN NAMEâ
If Gateway Server enabled, defaults for âlorawan-01.MY DOMAIN NAMEâ:
gs:
mqtt:
public-address: âlorawan-01.MY DOMAIN NAME:1882â
public-tls-address: âlorawan-01.MY DOMAIN NAME:8882â
mqtt-v2:
public-address: âlorawan-01.MY DOMAIN NAME:1881â
public-tls-address: âlorawan-01.MY DOMAIN NAME:8881â
forward:Forward traffic to the Network Server in the cluster
- âcluster=SECRET/7â # Enter your DevAddr range
Forward all traffic also to Packet Broker
- âpacketbroker=SECRET/0â
Network Server configuration.
ns:
net-id: âSECRETâIf Gateway Configuration Server enabled, defaults for âlorawan-01.MY DOMAIN NAMEâ:
gcs:
basic-station:
default:
lns-uri: âwss://lorawan-01.MY DOMAIN NAME:8887â
the-things-gateway:
default:
mqtt-server: âmqtts://lorawan-01.MY DOMAIN NAME:8881âWeb UI configuration for âlorawan-01.MY DOMAIN NAMEâ:
console:
ui:
canonical-url: âhttps://lorawan-01.MY DOMAIN NAME/consoleâ
account-url: âhttps://lorawan-01.MY DOMAIN NAME/consoleâ
is:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
gs:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
gcs:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
ns:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
as:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
js:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
qrg:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
edtc:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
dcs:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
oauth:
authorize-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/authorizeâ
token-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/tokenâ
logout-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/logoutâ
client-id: âSECRETâ
client-secret: âSECRETâ # choose or generate a secretIf Application Server enabled, defaults for âlorawan-01.MY DOMAIN NAMEâ:
as:
mqtt:
public-address: âlorawan-01.MY DOMAIN NAME:1883â
public-tls-address: âlorawan-01.MY DOMAIN NAME:8883â
webhooks:
downlink:
public-address: âlorawan-01.MY DOMAIN NAME:1885/api/v3âIf Device Claiming Server enabled, defaults for âlorawan-01.MY DOMAIN NAMEâ:
dcs:
oauth:
authorize-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/authorizeâ
token-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/tokenâ
logout-url: âhttps://lorawan-01.MY DOMAIN NAME/oauth/logoutâ
client-id: âdevice-claimingâ
client-secret: âdevice-claimingâ # choose or generate a secret
ui:
canonical-url: âhttps://lorawan-01.MY DOMAIN NAME/claimâ
as:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
dcs:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
is:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3â
ns:
base-url: âhttps://lorawan-01.MY DOMAIN NAME/api/v3âPacket Broker Agent configuration
pba:
See https://packetbroker.net for available hosts
data-plane-address: âeu1.packetbroker.io:443â
net-id: âSECRETâ
tenant-id: âSECRETâ # Leave empty if you own the NetID and you donât use tenants
cluster-id: ââ # Unique identifier of your routing cluster
authentication-mode: âoauth2â
oauth2:
client-id: âSECRETâ # API key ID
client-secret: âSECRETâ # Secret API key value
forwarder:
enable: true
# generate 16 bytes (openssl rand -hex 16)
token-key: âSECRETâ
home-network:
enable: true
In the device page, I see this error:
However, after searching for the error:
synthetic.error.network_error
I did find: Status of our TTG gateway is disconnected - name": "synthetic.error.network_error",
Though, I am sure I donât have the ID duped, as I have only entered it once. Could this be because it is entered in my other instance still running on AWS?
I am wondering if there is a place where I can find detailed debug logs or something like this.
I am pretty sure the ports are all opened in my firewall though, it seems like they are not:
The ports in this image open the ports to the box running the reverse proxy, though I have also tried the one running TTS. I may change it back to see if there is another change.
The version I am currently running is: 3.25.1
everything is running on Ubuntu version 22.04.2 LTS
the reverse proxy, TTS, and one gateway are on the same network,
the 2nd gateway is on another network.
A little more interesting info:
I need to try an integration to see if it is sending data, and just not displaying it to me, or if it seems to be detecting the end, and not actually sending data between the TTS services
Any assistance would be greatly appreciated!
Thank you all very much,
-Kevinr