Commit 96136d8b authored by Chris Croome's avatar Chris Croome
Browse files

Added .deb update script and some things to README

parent 25aa341c
......@@ -32,17 +32,54 @@ These playbooks:
* Install [Docker Compose](https://docs.docker.com/compose/install/)
* Install [Mailcow Dockerized](https://github.com/mailcow/mailcow-dockerized)
## Update Docker Compose
```
export SERVERNAME="webarch.email"
ansible-playbook docker_compose_update.yml -u root -i ${SERVERNAME}, -e "hostname=${SERVERNAME}"
```
### Update Docker
This playbook updates all `.deb` packages via apt, it might need to do some
specific things for Docker CE, it should be checked when the next Docker update
is available.
```
export SERVERNAME="webarch.email"
ansible-playbook docker_update.yml -u root -i ${SERVERNAME}, -e "hostname=${SERVERNAME}"
```
## Containers
Stop all containers:
```bash
su - mailcow
cd /var/mailcow
docker-compose down
```
Start all containers and detach (so you don't get the logs in the console):
```bash
su - mailcow
cd /var/mailcow
docker-compose up -d
```
Restart a container:
```bash
su - mailcow
cd /var/mailcow
docker-compose restart nginx-mailcow
```
Connect to a container, [see the documentation](https://mailcow.github.io/mailcow-dockerized-docs/debug-attach_service/), not all containers have Bash, some examples:
```
```bash
su - mailcow
cd /var/mailcow
source mailcow.conf
......@@ -51,7 +88,7 @@ docker-compose exec dovecot-mailcow /bin/sh
To connect to MySQL:
```
```bash
su - mailcow
cd /var/mailcow
source mailcow.conf
......@@ -60,19 +97,12 @@ docker-compose exec mysql-mailcow mysql -u${DBUSER} -p${DBPASS} ${DBNAME}
Or use the alias the `mailcow` user has:
```
```bash
su - mailcow
cd /var/mailcow
docker-mysql
```
## Update Docker Compose
```
export SERVERNAME="webarch.email"
ansible-playbook docker_compose_update.yml -u root -i ${SERVERNAME}, -e "hostname=${SERVERNAME}"
```
## Logs
You can get the logs for a container like this:
......
---
- name: Install Docker MailCow
hosts: "{{ hostname }}"
vars:
distro: stretch
nameserver_1: 81.95.52.30
nameserver_2: 81.95.52.24
vars_prompt:
- name: "docker_compose_version"
prompt: "The Docker Compose version from https://github.com/docker/compose/releases"
private: no
default: "1.14.0"
- name: "passwd_reminder"
prompt: "If this is a first run you MUST complete the following password fields:"
private: no
default: "agree"
- name: "mailcow_admin_password"
prompt: "Password for the Mailcow admin user [Blank to leave unchanged]"
private: yes
confirm: yes
- name: "mailcow_rspamd_password"
prompt: "Password for Rspamd [Blank to leave unchanged]"
private: yes
confirm: yes
roles:
- docker
- docker-compose
- mailcow
# - letsencrypt mailcow now provisions let's encrypt certs
- dovecot
- rspamd
# Syslog was throwing errors and there is now a web interface to view some
# logs
# - syslog
- postfix
- theme
- resolv
- munin-node
......@@ -14,14 +14,21 @@
- debug:
msg: "Machine hardware: {{ machine_hardware.stdout }}"
- debug:
msg: "About to fetch https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-{{ kernel_name.stdout }}-{{ machine_hardware.stdout }}"
- name: Docker Compose version {{ docker_compose_version }} installed
get_url:
url: "https://github.com/docker/compose/releases/download/{{ docker_compose_version }}/docker-compose-{{ kernel_name.stdout }}-{{ machine_hardware.stdout }}"
dest: /usr/local/bin/docker-compose
force: yes
backup: yes
mode: 0755
- name: Docker Compose Bash completion in place
get_url:
url: "https://raw.githubusercontent.com/docker/compose/{{ docker_compose_version }}/contrib/completion/bash/docker-compose"
dest: /etc/bash_completion.d/docker-compose
force: yes
backup: yes
mode: 0644
---
- name: Update apt package list
apt:
update_cache: yes
- name: Check if the Webarchitects logchange script is installed
command: which logchange
register: logchange
- block:
- name: Get a list of the updates
shell: "apt-show-versions -b -u | xargs"
register: apt_updates
- name: Record the updates in the /root/Changelog
command: 'logchange "{{ apt_updates.stdout }} : updated"'
when: apt_updates.stdout != ""
when: logchange.stdout != ""
- name: Update all packages
apt:
upgrade: dist
autoclean: yes
- name: Check if the Munin apt state file exists
stat:
path: "/var/lib/munin-node/plugin-state/nobody/plugin-apt.state"
register: munin_apt_state
- block:
- name: Delete the Munin apt state file
file:
dest: "/var/lib/munin-node/plugin-state/nobody/plugin-apt.state"
state: absent
- name: Update the Munin apt state file
command: munin-run apt_all
when: munin_apt_state.stat.exists == True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment