88 lines
2.2 KiB
Markdown
88 lines
2.2 KiB
Markdown
## Database
|
|
|
|
### postgres
|
|
|
|
- Host: postgres
|
|
|
|
```bash
|
|
$ create-postgres-user-and-database foo bar # create user `foo` and give him access to database `bar`
|
|
```
|
|
|
|
Administration shell:
|
|
|
|
```bash
|
|
$ sudo psql -h postgres -U postgres
|
|
psql> \l # list databases
|
|
psql> \c <database> # connect to database
|
|
psql> \d # show tables
|
|
$ sudo pg_dump -h postgres -U postgres <dbname> > dump.sql # backup
|
|
$ sudo psql -h postgres -U postgres < dump.sql # restore
|
|
```
|
|
|
|
|
|
### mysql
|
|
|
|
- Host: mysql
|
|
|
|
```bash
|
|
$ create-mysql-user-and-database foo # create database and user `foo`
|
|
```
|
|
|
|
## List zfs snapshots
|
|
|
|
```bash
|
|
$ cd /data/containers/<name>/rootfs/.zfs # .zfs directory is hidden and will not be shown by `ls -a`
|
|
$ ls
|
|
```
|
|
|
|
## Backups
|
|
|
|
* located in /backup/rsync
|
|
* mysql dumps: /backup/rsync/mysqldbs
|
|
* postgres dumps: /backup/rsync/postgresdbs
|
|
* zfs snapshosts: /backup/rsync/.zfs/snapshot
|
|
* default backup location for containers: home, srv, etc, usr/local
|
|
* systemd service files: backup-daily.{timer,service}, backup-weekly.{timer,service}
|
|
|
|
## Ldap
|
|
|
|
Administration: https://ldap.higgsboson.tk
|
|
|
|
| objectclass | description |
|
|
| ----------- | ---------------------------- |
|
|
| mailaccount | access imap/smtp |
|
|
| owncloud | https://cloud.higgsboson.tk |
|
|
| gitlab | https://git.higgsboson.tk |
|
|
| ttrss | https://rss.higgsboson.tk |
|
|
| jabber | xmpp |
|
|
|
|
## Mail
|
|
|
|
| Key | Value |
|
|
| ----------- |----------------------------- |
|
|
| Imap | imap.higgsboson.tk, Port 143 |
|
|
| Smtp | smtp.higgsboson.tk, Port 567 |
|
|
| Sieve | imap.higgsboson.tk, Port 4190|
|
|
| Webmail | https://mail.higgsboson.tk |
|
|
| Encryption | STARTTLS or TLS |
|
|
| MX-Record | mail.higgsboson.tk |
|
|
| SRV-Record | v=spf1 a:mail.higgsboson.tk ip6:2a01:4f8:210:31fd:1::10 -all |
|
|
|
|
## LXC
|
|
|
|
```bash
|
|
$ lxc-attach -n <name> # login
|
|
$ systemctl start lxc@<name> # start container
|
|
$ systemctl stop lxc@<name> # stop container
|
|
```
|
|
|
|
## Get logs
|
|
|
|
`lxc-log <CONTAINER> <SERVICE>`
|
|
|
|
example:
|
|
```bash
|
|
$ lxc-log mail postfix # get logs of postfix service in the mail container
|
|
$ lxc-log mail postfix -f # Additional parameter are passed to journalctl
|
|
```
|