Switch local testing to subdomain model

Requires manual setup through hosts file or dns server for now.
This commit is contained in:
Marty Oehme 2021-12-09 15:34:49 +01:00
parent c5eac2a846
commit b393c0b946
Signed by: Marty
GPG key ID: B7538B8F50A1C800
4 changed files with 30 additions and 10 deletions

View file

@ -3,7 +3,7 @@
## Testing
This repository comes with a test-ready setup to try out the complete site setup locally.
It uses vagrant to accomplish this and create a pretend target host.
It uses vagrant to accomplish this and create a locally available target host.
Install [vagrant](https://www.vagrantup.com/) on your system and to make tests repeatable also install the vagrant plugins `vagrant-hosts` and `vagrant-hostsupdater`,
which will set a static IP for the vagrant host to be reachable under.
@ -11,6 +11,22 @@ which will set a static IP for the vagrant host to be reachable under.
vagrant plugin install vagrant-hosts vagrant-hostsupdater
```
Additionally, since the test setup mirrors the production setup in that it makes use of subdomains for the individual hosted applications,
the server needs to be reachable under a domain name,
not just an IP address.
For now this is most simply accomplished through editing the hosts file, e.g.:
```hosts
192.168.56.2 ansible.test
192.168.56.2 git.ansible.test
192.168.56.2 links.ansible.test
```
This will allow you to reach the main domain under `http(s)://ansible.test` and sets up two subdomains that can be reached.
Be aware that the hosts file does not support subdomain wildcards.
You will have to specify each hostname individually or use a tool such as `dnsmasq`.
Read more [here](https://serverfault.com/questions/118378/in-my-etc-hosts-file-on-linux-osx-how-do-i-do-a-wildcard-subdomain).
Then you are ready to run the complete infrastructure setup locally,
simply by executing `ansible-playbook site.yml`.
You can of course pick and choose what should be executed with host limits, tags, group variables, and so on,