Shared Devilbox server in LAN
Shared Devilbox server in LAN
Devilbox as a shared development, staging or CI server is setup in a similar way as you would do locally. The only three important parts to take care of are:
- Project access to deploy/update code
- Handle DNS entries
- Share Devilbox CA
Prerequisites
This walk-through will use the following example values:
| LAN / Network | Devilbox server | TLD_SUFFX | LOCAL_LISTEN_ADDR |
|---|---|---|---|
192.168.0.0/24 | 192.168.0.12 | loc | 192.168.0.12 or empty |
* env-tld-suffix * env-local-listen-addr
Project access
SSH
Enable and start an SSH server and give access to whatever system or user requires it. This can be done directly on the host system or via various other Docker container that offer ssh server.
Copy via sftp
If your SSH server is setup, users can use their sftp clients to deploy code updates. This however is not encouraged and you should use git or any other version control system.
Manually git pull/checkout
When using git, users can directly ssh into the shared Devilbox server
and git pull or git checkout <branch> on their projects.
Automated git pull/checkout
In case you are using a staging or CI server, use Jenkins jobs or other automation tools (e.g. Ansible) to auto-deploy via SSH.
Samba
For a shared development server, you could also setup Samba network shares for each projects and have users deploy their code via Samba.
Handle DNS records
There are multiple ways of having DNS records available accross the LAN.
Before you read on, have a quick look on the decision Matrix to find the best method for your use-case.
| Method | Sub-method | Outcome |
|---|---|---|
| Real domain | All network devices will have Auto DNS | |
| Own DNS server | All network devices will have Auto DNS | |
| Devilbox DNS server | Manual | Every network device must configure its DNS settings |
| DHCP distributed | All network devices will have Auto DNS | |
| Hosts entry | Every network device must manually set hosts entries
for each project. (Does not work for phones) |
[!IMPORTANT] When using a shared Devilbox server and another Devilbox setup on your local computer, ensure that you are using different
env-tld-suffixin order to not confuse DNS records.
Use a real domain
(This will allow all devices on the network to have Auto-DNS)
If you own a real domain, such as my-company.com, you can create a
wildcard DNS record for a subdomain, such as *.dev.my-company.com
which must point to 192.168.0.12.. This should be done in your hosting
provider’s DNS configuration pannel.
You must then also change the TLD_SUFFIX to that subdomain.
TLD_SUFFIX=dev.my-company.comHandle DNS records in your own DNS server
(This will allow all devices on the network to have Auto-DNS)
If your LAN already provides its own customizable DNS server, you can
setup a new wildcard DNS zone for *.loc which points to
192.168.0.12.
Run a second instance of the Devilbox DNS server
If the above two methods for automated DNS records don’t apply to you, you will need to run a second stand-alone Docker container of the Devilbox DNS server.
Run this container permantently on the shared Devilbox server with the following command:
host> docker run -d \ --restart unless-stopped \ -p 53:53/tcp \ -p 53:53/udp \ -e WILDCARD_DNS='loc=192.168.0.12' \ -t cytopia/bindNow there are two ways to consume the DNS records on your local machine:
- Manual
- DHCP distributed
Manual DNS settings
(Each device on the network needs to manually set the DNS server)
When using this approach, you have to manually add the DNS server (IP:
192.168.0.12) to your host operating system.
[!IMPORTANT] Keep in mind that you have to do this for every machine within the network which wants to access the shared Devilbox server.
* howto-add-custom-dns-server-on-linux *
howto-add-custom-dns-server-on-mac *
howto-add-custom-dns-server-on-win *
howto-add-custom-dns-server-on-android *
howto-add-custom-dns-server-on-iphone
DHCP distributed
(This will allow all devices on the network to have Auto-DNS)
This is the automated and more pain-free approach, as all devices within the network will be able to access projects on the shared Devilbox server.
Self-managed DHCP server
If you run your own DHCP server within a network, you probably know how to add other DNS servers. The only thing you should keep in mind is, that the Devilbox DNS server should be the first in the list.
DSL box / LAN or WIFI router
Most SOHO
networks probably use some vendor router which has a web interface.
Generally speaking, you need to find the DNS/DHCP settings in its web
interface and add the Devilbox DNS server as the first in the list
(192.168.0.12).
Add hosts entries for every project
(Each device on the network needs to manually set the hosts entries for every single projcet)
As you also do for the Devilbox locally when not using Auto-DNS, you can do as well for remote computer. Just edit your local hosts file and add one DNS entry for every project on the shared Devilbox server.
Keep in mind that this time you will have to use 192.168.0.12 instead
of 127.0.0.1.
* howto-add-project-hosts-entry-on-linux *
howto-add-project-hosts-entry-on-mac *
howto-add-project-hosts-entry-on-win
Share Devilbox CA
The last step to also have valid HTTPS connections on your shared Devilbox server is to copy the CA onto your local machine and import it into your browser or system.
setup-valid-https