Vagrant-based testing environment #111
No reviewers
Labels
No labels
Blocked
Existing Service
Infrastructure Issue
Refactor
Security Hardening
Security Issue
Service Idea
Service Removal
Upgrade service
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: data.coop/ansible#111
Loading…
Reference in a new issue
No description provided.
Delete branch "vagrant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The purpose of this PR is to provide a way to test our setup locally, since we don't have a staging server (yet).
I have fixed the existing Vagrantfile to work with our Ansible setup, and then I have refactored the Ansible setup a bit to work with Vagrant. I have also fixed a couple errors preventing deployment in general. The fixes include:
postfix
Docker network exist when the other services need itconfig_path
from thedocker_login
task, so that when deployed in Vagrant, it can connect to the remote registry running on the production serverThe only thing I would like some input on is, that when trying to deploy Mailu, it fails to link the TLS certificate files from nginx-proxy, since they don't exists due to missing DNS records to the Vagrant VM (of course). How should we handle that? One way would be to add
ignore_errors: true
to said tasks, but that would cause ignored errors in production as well, which is undesirable. Or maybe we could skip the aforementioned tasks only if it's running in a VM, the same way I have done it with Dell OpenManage. Other suggestions are welcomed.Vagrant-based testing environmentto WIP: Vagrant-based testing environment@valberg suggested using vagrant-dns with a custom
base_domain
(e.g.datacoop.devel
) for accessing services from Vagrant. We still need to figure out the TLS problem though.TODO: Allocate time to look into it.
UPDATE: Unfortunately it only works on macOS :(
Regarding the certificate issue I think we should do the following:
ssl_certs_enabled
which defaults toansible_virtualization_role != guest
(this probably means that we can movevirtualization.yml
intoplaybook.yml
because it becomes a core task that always should run)nginx letsencrypt container
task in `nginx-proxy.yml behind that taghard link to Let's Encrypt TLS (certificate|key)
inmailu.yml
behind that tagWe might have other places where ssl can be switched on/off, we can find and fix these as we go along.
We should consider adding some documentation on how to use the vagrant setup - in fact we need a README.md for the whole repo. This is as good a time as any to add that.
5d0c913c2a
to253a21432e
@samsapti I just implemented my idea of how to do the SSL part. I then realized that the variable is more a
letsencrypt_enabled
and we could do some "self signed certs" if that variable is set to True. But it feels like quite the effort.No, we can't do that, because the SSH port needs to be configured before it can run. When running in Vagrant,
ansible_port
is set to 2222 regardless of what the inventory file says.I have moved it already. I think we should just not do the SSH port stuff if
vagrant == true
I think you mean if it's set to False, but I get your point. Could we perhaps drop TLS entirely when running in Vagrant? I can't really see why we would need it.
Ah yes of course 😊 well I mostly agree, but being able to run the whole infrastructure with self signed certs could make sense - somehow. But let's not spend time on that now.
We still need to change the port, because Gitea needs port 22. The Vagrant VM's internal SSH port is default 22, it's only the forwarded port to the host that's 2222. Also, the point of running in Vagrant is to be able to test as much of the infrastructure as possible, so I disagree here.
I've implemented a different approach. According to Vagrant, this works as it should.
Just referencing #59 here.
@valberg, looks good! I haven't tested it yet though.
c802e53858
tod48e684647
WIP: Vagrant-based testing environmentto Vagrant-based testing environmentI think this is ready to be merged.