summaryrefslogtreecommitdiff
path: root/Readme.md
blob: 71b6685b96aa2e788729ee0a81c5c9b30f427426 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Mastodon Docker Setup with traefik
===

The scripts provided modify the official `docker-compose.yml` file
to be

- fast and easy to set up, without build step
- usable with [traefik](https://traefik.io/)

The provided [docker-compose.yml](docker-compose.yml) file can be used to set up traefik.

## Requirements

- PHP
- Docker
- [traefik](https://traefik.io/)


## Instructions

Run the scripts in the following order

```
./bin/build.php
./bin/setup.php
./bin/run.php
```

### Build

```
./bin/build.php
```

Builds the docker-compose.yml file with traefik labels


### Setup

```
./bin/setup.php
```

This runs the `mastodon:setup` command to populate the `.env.production` file.

Config:

- Domain name: ${same as in .env DOMAIN}
- Single user mode?: up to you
- Using docker?: Yes
- PostgreSQL host: default (db)
- PostgreSQL port: default (5432)
- PostgreSQL database: default (postgres)
- PostgreSQL user: default (postgres)
- PostgreSQL password: ${same as in .env POSTGRES_PASSWORD}
- Redis host: default (redis)
- Redis port: default (6379)
- Redis password: default (empty)
- Store uploaded files on the cloud?: up to you
- Send e-mails from localhost?: up to you
- Save configuration?: y
- Prepare the database now?: y
- Create admin user?: up to you


### Run

```
./bin/run.php
```

Runs mastodon


## Using only the built docker-compose.yml file

You can get the built file here [docker-compose.yml](https://gitlab.com/dweipert.de/devops/mastodon-docker-traefik/-/packages/2252852)


### First time setup

- get the [.env.example](.env.example) file and save it as `.env`

- create `.env.production`
```
touch .env.production
```

- run `bundle exec rake mastodon:setup` in the `web` container
```
docker-compose run --rm -v $PWD/.env.production:/opt/mastodon/.env.production web bundle exec rake mastodon:setup
```


### Run all services

```
docker-compose up -d
```


## Credits

- https://github.com/peterrus/docker-mastodon
- https://gist.github.com/smashnet/38cf7c30cb06427bab78ae5ab0fd2ae3
- https://www.innoq.com/en/blog/traefik-v2-and-mastodon/
- https://gist.github.com/fredix/6ef5c95c600dbbb9afc0e0538a93d90d
- https://www.howtoforge.com/how-to-install-mastodon-social-network-with-docker-on-ubuntu-1804/
- https://github.com/silkkycloud/bitwarden