summaryrefslogtreecommitdiffhomepage
path: root/public/v4/apps/mastodon.yml
blob: 4b6d01ea6c88a6aa2e853bf62ee05a5daf8840a9 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
captainVersion: 4
services:
    # Mastodon
    $$cap_appname:
        environment:
            LOCAL_DOMAIN: $$cap_appname.$$cap_root_domain
            ALTERNATE_DOMAINS: $$cap_alt_domain
            REDIS_HOST: srv-captain--$$cap_appname-redis
            REDIS_PORT: 6379
            REDIS_PASSWORD: $$cap_redis_password
            DB_HOST: srv-captain--$$cap_appname-postgres
            DB_USER: mastodon
            DB_NAME: mastodon_production
            DB_PASS: $$cap_postgres_password
            DB_PORT: 5432
            ES_ENABLED: 'false'
            OTP_SECRET: $$cap_opt_secret_base
            SECRET_KEY_BASE: $$cap_secret_key_base
            VAPID_PRIVATE_KEY: $$cap_gen_random_hex(16)
            VAPID_PUBLIC_KEY: $$cap_gen_random_hex(16)
            SINGLE_USER_MODE: $$cap_su_mode
            SMTP_SERVER: $$cap_smtp_server
            SMTP_PORT: $$cap_smtp_port
            SMTP_LOGIN: $$cap_smtp_user
            SMTP_PASSWORD: $$cap_smtp_pass
            SMTP_FROM_ADDRESS: $$cap_smtp_from
            SMTP_TLS: $$cap_smtp_tls
            S3_ENABLED: 'false'
            RAILS_ENV: production
        volumes:
            - $$cap_appname-system:/mastodon/public/system
        caproverExtra:
            containerHttpPort: '3000'
            dockerfileLines:
                - FROM tootsuite/mastodon:$$cap_mastodon_version
                - CMD rm -f /mastodon/tmp/pids/server.pid; bundle exec rails db:setup; bundle exec rails s -b 0.0.0.0 -p 3000
    # Streaming
    $$cap_appname-streaming:
        environment:
            LOCAL_DOMAIN: $$cap_appname.$$cap_root_domain
            ALTERNATE_DOMAINS: $$cap_alt_domain
            REDIS_HOST: srv-captain--$$cap_appname-redis
            REDIS_PORT: 6379
            REDIS_PASSWORD: $$cap_redis_password
            DB_HOST: srv-captain--$$cap_appname-postgres
            DB_USER: mastodon
            DB_NAME: mastodon_production
            DB_PASS: $$cap_postgres_password
            DB_PORT: 5432
            ES_ENABLED: 'false'
            OTP_SECRET: $$cap_opt_secret_base
            SECRET_KEY_BASE: $$cap_secret_key_base
            VAPID_PRIVATE_KEY: $$cap_gen_random_hex(16)
            VAPID_PUBLIC_KEY: $$cap_gen_random_hex(16)
            SINGLE_USER_MODE: $$cap_su_mode
            SMTP_SERVER: $$cap_smtp_server
            SMTP_PORT: $$cap_smtp_port
            SMTP_LOGIN: $$cap_smtp_user
            SMTP_PASSWORD: $$cap_smtp_pass
            SMTP_FROM_ADDRESS: $$cap_smtp_from
            SMTP_TLS: $$cap_smtp_tls
            S3_ENABLED: 'false'
            RAILS_ENV: production
        volumes:
            - $$cap_appname-system:/mastodon/public/system
        caproverExtra:
            containerHttpPort: '4000'
            dockerfileLines:
                - FROM tootsuite/mastodon:$$cap_mastodon_version
                - CMD node ./streaming
    # Sidekiq
    $$cap_appname-sidekiq:
        environment:
            LOCAL_DOMAIN: $$cap_appname.$$cap_root_domain
            ALTERNATE_DOMAINS: $$cap_alt_domain
            REDIS_HOST: srv-captain--$$cap_appname-redis
            REDIS_PORT: 6379
            REDIS_PASSWORD: $$cap_redis_password
            DB_HOST: srv-captain--$$cap_appname-postgres
            DB_USER: mastodon
            DB_NAME: mastodon_production
            DB_PASS: $$cap_postgres_password
            DB_PORT: 5432
            ES_ENABLED: 'false'
            OTP_SECRET: $$cap_opt_secret_base
            SECRET_KEY_BASE: $$cap_secret_key_base
            VAPID_PRIVATE_KEY: $$cap_gen_random_hex(16)
            VAPID_PUBLIC_KEY: $$cap_gen_random_hex(16)
            SINGLE_USER_MODE: $$cap_su_mode
            SMTP_SERVER: $$cap_smtp_server
            SMTP_PORT: $$cap_smtp_port
            SMTP_LOGIN: $$cap_smtp_user
            SMTP_PASSWORD: $$cap_smtp_pass
            SMTP_FROM_ADDRESS: $$cap_smtp_from
            SMTP_TLS: $$cap_smtp_tls
            S3_ENABLED: 'false'
            RAILS_ENV: production
        volumes:
            - $$cap_appname-system:/mastodon/public/system
        caproverExtra:
            dockerfileLines:
                - FROM tootsuite/mastodon:$$cap_mastodon_version
                - CMD bundle exec sidekiq
            notExposeAsWebApp: 'true'
    # PostgreSQL
    $$cap_appname-postgres:
        image: postgres:14-alpine
        volumes:
            - $$cap_appname-postgres-data:/var/lib/postgresql/data
        environment:
            POSTGRES_USER: mastodon
            POSTGRES_PASSWORD: $$cap_postgres_password
            POSTGRES_DB: mastodon_production
        caproverExtra:
            notExposeAsWebApp: 'true'
    # Redis
    $$cap_appname-redis:
        volumes:
            - $$cap_appname-redis-data:/data
        environment:
            REDIS_PASSWORD: $$cap_redis_password
        caproverExtra:
            dockerfileLines:
                - FROM redis:alpine
                - CMD exec redis-server --requirepass "$$cap_redis_password"
            notExposeAsWebApp: 'true'
caproverOneClickApp:
    variables:
        - id: $$cap_mastodon_version
          label: Mastodon Version Tag
          description: You can use latest tag or check version builds on https://hub.docker.com/r/tootsuite/mastodon/tags
          defaultValue: v4.1

        - id: $$cap_secret_key_base
          defaultValue: $$cap_gen_random_hex(64)
          label: Secret Key Base
          description: The randomized string which is used to verify the integrity of signed cookies. Please use a string with more than 26 characters
          validRegex: /^[^\@]{26,}$/

        - id: $$cap_opt_secret_base
          defaultValue: $$cap_gen_random_hex(64)
          label: One-time password secret
          description: Two-Factor Authentication (2FA) Key
          validRegex: /^[^\@]{26,}$/

        - id: $$cap_postgres_password
          defaultValue: $$cap_gen_random_hex(12)
          label: Postgres Password
          description: Password must be at least 12 characters.  Please use a random string.
          validRegex: /^[^\@]{12,}$/

        - id: $$cap_redis_password
          defaultValue: $$cap_gen_random_hex(12)
          label: Redis Password
          description: Password must be at least 12 characters. Please use a random string.
          validRegex: /^[^\@]{12,}$/

        - id: $$cap_alt_domain
          label: Alternate domains (optional)
          description: If you have multiple domains pointed at your Mastodon server, this setting will allow Mastodon to recognize itself when users are addressed using those other domains. Separate the domains by commas, e.g. foo.com,bar.com

        - id: $$cap_su_mode
          label: Single user mode
          defaultValue: 'false'
          description: If set to true, the frontpage of your Mastodon server will always redirect to the first profile in the database and registrations will be disabled.

        - id: $$cap_smtp_server
          label: SMTP hostname
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_smtp_user
          label: SMTP username
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_smtp_from
          label: SMTP from
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_smtp_pass
          label: SMTP password
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_smtp_port
          label: SMTP port
          validRegex: /^([^\s^\/])+$/

        - id: $$cap_smtp_tls
          label: SMTP TLS
          validRegex: /^([^\s^\/])+$/
    instructions:
        start: >-
            Your self-hosted, globally interconnected microblogging community

        end: >-
            Before you proceed keep a note of the following.

            --------------------------------------------------

            After you deploy mastodon and created your fist user in the browser, you will need to use the command line to give your newly created account admin privileges.


            Step 1: From your terminal run the following command.

            `docker exec -it $(docker ps --filter name='srv-captain--$$cap_appname.1' -q) /bin/bash`


            Step 2: Now that you are inside your mastodon container: run the following command assuming your username is alice:

            `RAILS_ENV=production bin/tootctl accounts modify alice --role Admin`


            Step 3: Now we have to give our persistent directory the correct user rights

            From your terminal run the following assuming your app name is mastodon

            `chown -R 991:991 /var/lib/docker/volumes/captain--$$cap_appname-system`


            --------------------------------------------------

            Aaaand you're done! 😄

            Your service is available at http://$$cap_appname.$$cap_root_domain


            You can add more environment variables to use with aws s3 for example

            Check out https://docs.joinmastodon.org/admin/config/ for more env vars

    displayName: Mastodon
    isOfficial: true
    description: Social networking, back in your hands.
    documentation: 'Read more at: https://docs.joinmastodon.org/'