Update docker case, improve readme and add testable docker case with vagrant
This commit is contained in:
parent
2d7ab9bedc
commit
a6d9be49dd
42
README.md
42
README.md
|
@ -2,12 +2,46 @@
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
This role compiles the [bibliogram][1] artifact from the source. To make it
|
This role sets up a [bibliogram][1] node with one of two methods:
|
||||||
easiery, a `Dockerfile` is provided. So you need `docker` installed.
|
|
||||||
|
|
||||||
## Run
|
- orchestrating it via `systemd`
|
||||||
|
- orchestrating it via `docker`
|
||||||
|
|
||||||
Just use it as an ansible role in your playbook.
|
You have to choose which method to use.
|
||||||
|
|
||||||
|
## Variables
|
||||||
|
|
||||||
|
These are the default values
|
||||||
|
```
|
||||||
|
---
|
||||||
|
ansible_bibliogram_port: "10407"
|
||||||
|
ansible_bibliogram_with_docker: false
|
||||||
|
ansible_bibliogram_with_systemd: false
|
||||||
|
ansible_bibliogram_backup_frequency: "daily"
|
||||||
|
ansible_bibliogram_root_directory: "/var/www/bibliogram"
|
||||||
|
ansible_bibliogram_tor_enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
It is **mandatory** to set a value for `ansible_bibliogram_base_url`, that
|
||||||
|
points to the public url (together with the protocol and port if not default!)
|
||||||
|
the service is available at.
|
||||||
|
|
||||||
|
## Develop
|
||||||
|
|
||||||
|
A `Vagrantfile` is provided. You can run the `systemd` case with
|
||||||
|
|
||||||
|
```
|
||||||
|
$ vagrant up --provider=libvirt --provision
|
||||||
|
```
|
||||||
|
|
||||||
|
or the `docker` case with
|
||||||
|
|
||||||
|
```
|
||||||
|
$ ANSIBLE_BIBLIOGRAM_DOCKER=1 vagrant up --provider=libvirt --provision
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, if you put `debiantest 192.168.123.2` in your `/etc/hosts`, you should be
|
||||||
|
able to reach a bibliogram instance at `http://debiantest:10407`.
|
||||||
|
|
||||||
|
|
||||||
[1]: https://git.sr.ht/~cadence/bibliogram
|
[1]: https://git.sr.ht/~cadence/bibliogram
|
||||||
|
|
8
Vagrantfile
vendored
8
Vagrantfile
vendored
|
@ -3,6 +3,8 @@
|
||||||
# to upgrade instead of disabling the requirement below.
|
# to upgrade instead of disabling the requirement below.
|
||||||
Vagrant.require_version ">= 1.7.0"
|
Vagrant.require_version ">= 1.7.0"
|
||||||
|
|
||||||
|
docker = ENV['ANSIBLE_BIBLIOGRAM_DOCKER'] == '1'
|
||||||
|
|
||||||
Vagrant.configure(2) do |config|
|
Vagrant.configure(2) do |config|
|
||||||
|
|
||||||
config.vm.box = "debian/buster64"
|
config.vm.box = "debian/buster64"
|
||||||
|
@ -25,7 +27,11 @@ Vagrant.configure(2) do |config|
|
||||||
config.vm.provision "ansible" do |ansible|
|
config.vm.provision "ansible" do |ansible|
|
||||||
ansible.become = true
|
ansible.become = true
|
||||||
ansible.verbose = "v"
|
ansible.verbose = "v"
|
||||||
ansible.playbook = "playbook.yml"
|
if docker == true
|
||||||
|
ansible.playbook = "playbook_docker.yml"
|
||||||
|
else
|
||||||
|
ansible.playbook = "playbook_systemd.yml"
|
||||||
|
end
|
||||||
ansible.inventory_path = "inventory"
|
ansible.inventory_path = "inventory"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
27
playbook_docker.yml
Normal file
27
playbook_docker.yml
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
- hosts: debiantest
|
||||||
|
gather_facts: yes
|
||||||
|
vars_files:
|
||||||
|
- ./test/vars_docker.yml
|
||||||
|
pre_tasks:
|
||||||
|
- debug: var=ansible_python_interpreter
|
||||||
|
- debug: var=ansible_python_version
|
||||||
|
- name: Install docker
|
||||||
|
shell: |
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y \
|
||||||
|
apt-transport-https \
|
||||||
|
ca-certificates \
|
||||||
|
curl \
|
||||||
|
gnupg-agent \
|
||||||
|
software-properties-common
|
||||||
|
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
|
||||||
|
add-apt-repository \
|
||||||
|
"deb [arch=amd64] https://download.docker.com/linux/debian \
|
||||||
|
$(lsb_release -cs) \
|
||||||
|
stable"
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- ansible-bibliogram
|
|
@ -2,7 +2,7 @@
|
||||||
- hosts: debiantest
|
- hosts: debiantest
|
||||||
gather_facts: yes
|
gather_facts: yes
|
||||||
vars_files:
|
vars_files:
|
||||||
- ./test/vars.yml
|
- ./test/vars_systemd.yml
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- ansible-bibliogram
|
- ansible-bibliogram
|
|
@ -1,9 +1,14 @@
|
||||||
---
|
---
|
||||||
|
- name: Ensure dependency is present
|
||||||
|
apt:
|
||||||
|
name: python3-docker
|
||||||
|
state: present
|
||||||
|
|
||||||
- name: Grab official docker image and start it
|
- name: Grab official docker image and start it
|
||||||
docker_container:
|
docker_container:
|
||||||
|
name: bibliogram
|
||||||
image: cloudrac3r/bibliogram
|
image: cloudrac3r/bibliogram
|
||||||
registry: docker.io
|
restart_policy: always
|
||||||
restart: always
|
|
||||||
pull: yes
|
pull: yes
|
||||||
volumes:
|
volumes:
|
||||||
- "db:/app/db"
|
- "db:/app/db"
|
||||||
|
|
4
test/vars_docker.yml
Normal file
4
test/vars_docker.yml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
ansible_bibliogram_base_url: "http://debiantest:10407"
|
||||||
|
ansible_bibliogram_with_docker: true
|
||||||
|
ansible_bibliogram_tor_enabled: true
|
Loading…
Reference in New Issue
Block a user