Search code examples
dockernginxjirareverse-proxysynology

I want to access Jira (Docker on Synology DS716+II) from LAN not only via IP_OF_SYNOLOGY:PORT but for example jira.synology.local


I am working with a Synology NAS type aDS716+II, DSM 6.1.4-15217 Update 2 on which runs Docker with a Jira container.

So now what I want to do I'm assigned to get to work is to access Jira's webinterface with let's say jira.synology.local with synology being the servername.

I read a lot about nginx and how it's built in since DSM 6.X but I don't seem to get it to work properly at all.

I can access Jira's webinterface from another machine within the LAN via IP_OF_SYNOLGY:PORT so when setting up a reverse proxy on the server it should be pointing to LOCALHOST:PORT right? I have also tried using the actual IP instead of LOCALHOST but without success.

Settings of reverse proxy entry in DSM

I can access the interface of Synology itself not only via IP_OF_SYNOLGY:PORT but also via DOMAINNAME.LOCAL if I set the domain name.

I really don't know what I'm missing and I tried everything I could think of. Does someone has experience with this?

If some information is missing, I'll gladly provide it. I'm fairly new to synology I have to admit. Thanks in advance!


Solution

  • So this has gotten zero response but I figured probably someone will have a similar "problem" in the future, so I will answer anyway.

    I solved everything, when I setup Active Directory. When installing AD, the DNS-Server will automatically be installed too.

    So we have JIRA running in a Docker container (on port, let's say, 12345) and I want to access it via the LAN on jira.domainname.

    To do so we need to have installed DSM6.X or higher (for nginx) and the DNS-Server. That's it.

    In the DNS-Server you will have to create a new master zone

    Add new master Zone

    and apply the following settings, whereas you can freely choose the domain name and Master DNS server must be the IP of your synology station, since it functions as a DNS

    Create Master Zone

    Then you want to edit the Resource Record

    Edit Resource Record

    There you want to add an A Record Resource

    Add Resource Record A

    and an CNAME Record Resource

    Add Resource Record CNAME

    So your Resource Records will look like this

    Resource Records

    Now the last step for setting up the DNS server is to tell it what to do if there is no specific record for a query. So for example if you want to open jira.domainname in your browser, there is a specific record for that and the DNS server knows how to direct it. But if you want to open up for example google.com the DNS server has no information on that and does now know what to do. So what we do now is to to tell the DNS server to forward the request, if it has no records for a request. To do so, enable the forwarders and put in the IP of your gateway/ managed switch as primary and some public DNS server (8.8.8.8 for one of google's DNS server) as secondary.

    DNS Server Resolution

    Please remember that jira.domainname shall always be the domainname you choose and 192.168.0.200 shall always be the IP of your synology station.

    So now the DNS server is completely setup. Now we want to take advantage of the built-in reverse proxy (which runs on nginx in the background). To do so we navigate as seen here

    Reverse Proxy

    and create a new reverse proxy rule

    Reverse Proxy Rule

    So now that the URL's can point to the same destination (your synology, 192.168.0.200) but on different Port. That comes in very handy for some applications running in docker.

    So now if you are running this in an home setup or small office, you probably are working with standard issue commercial router such as for example a FritzBox by AVM. Those are pretty good but beware that some prohibit the so called DNS Rebinding which means that DNS requests pointing to a local IP will be not allowed. Since in this setup the DNS server (your synology) and the destination JIRA (also your synology) are in the same LAN, we have to create an exception. Probably other routers don't suppress those requests, but if so exceptions are necessary.

    So the next step, it to tell your Gateway or managed switch that it has to use the newly setup DNS server as the primary DNS server. For FritzBox' you can do so here

    FritzBox DNS Server

    put in the IP of your DNS server and an secondary DNS server. This is important as a fallback solution if your DNS server probably stops working at some point.

    enter image description here

    Now that everything is setup I would recommend to restart the router/ managed switch, synology and the workstation you are working on, to flush all caches. After that you can simply open your browser and type in jira.domainname and JIRA should open up. You can also open a terminal/ cmd and type in nslookup jira.domainname to see if it is being resolved correctly.

    I really hope this will help someone at some point and if there are any additional questions, please feel free to comment this or write me directly!