2020-12-07 19:45:06 +01:00
|
|
|
# dev
|
|
|
|
|
|
|
|
This directory contains some useful dockerfiles/makefiles that can be used
|
|
|
|
to test the deployment ansible playbooks.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
make arch # this builds a docker image based on archlinux and runs it
|
|
|
|
make debian # this builds a docker image based on debian and runs it
|
|
|
|
```
|
|
|
|
|
|
|
|
## Workflow
|
|
|
|
|
|
|
|
Start a builder in one shell:
|
|
|
|
|
|
|
|
```bash
|
2020-12-08 23:46:24 +01:00
|
|
|
while true; do make _run; done
|
2020-12-07 19:45:06 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
_check for the docker IP of the started container_.
|
|
|
|
|
|
|
|
Test the playbook in another shell:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ansible-playbook -v -i ./ansible-hosts playbooks/setup.yml
|
|
|
|
```
|
|
|
|
|
|
|
|
note: the ip address in `ansible-hosts` might have changed from `172.18.0.2`.
|
2020-12-08 22:06:03 +01:00
|
|
|
|
|
|
|
## Docker images
|
|
|
|
|
|
|
|
- Build: `make build-arch` or `make build-debian` to build the image.
|
|
|
|
- Run: `make run` to run the docker container. This bind-mounts `../` to
|
|
|
|
`/root/.dotfiles`, making it possible to test the repo in the container.
|
|
|
|
|
|
|
|
## Docker + Ansible
|
|
|
|
|
|
|
|
Run `dotfiles-dev` image using `make run`. This starts the container with
|
|
|
|
the local repository bind-mounted on `/root/.dotfiles`. To use a custom volume:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
docker run -v <volume>:/root/dofiles`
|
|
|
|
```
|
|
|
|
|
|
|
|
**IMPORTANT** if bind-mounting an already existing repository, run
|
|
|
|
`ansible` with `-e local_development=true` to avoid
|
|
|
|
clobbering the git history if you have unpushed commit (it won't
|
|
|
|
work if your repo is dirty).
|
2020-12-08 23:46:24 +01:00
|
|
|
|
|
|
|
Ansible can now be used to test the installation.
|
|
|
|
|
|
|
|
make ansible
|
|
|
|
|
|
|
|
## Releasing
|
|
|
|
|
|
|
|
Use `make release` to build an image from scratch, run it, install dotfiles
|
|
|
|
in the container using ansible, then commit the resulting container.
|