-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconfig.rb
More file actions
366 lines (340 loc) · 20.8 KB
/
config.rb
File metadata and controls
366 lines (340 loc) · 20.8 KB
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
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
require 'etc'
module Config
#-----------------------------------------------------------------------------------
# SYSTEM PATHS - Automatically detected, should work on most systems (OK TO LEAVE AS IS)
#-----------------------------------------------------------------------------------
# Current username - automatically detected from system
USER = ENV['USER'] || Etc.getlogin || `whoami`.strip
# User's home directory - automatically detected
HOME_DIR = ENV['HOME'] || "/Users/#{USER}"
# Data storage location - where persistent data will be stored
# CHANGE THIS if you want to store data elsewhere
DATA_DIR = "#{HOME_DIR}/data"
# Code repositories location - where git repos will be cloned
# CHANGE THIS if you want to store code elsewhere
CODE_DIR = "#{HOME_DIR}/code"
#-----------------------------------------------------------------------------------
# NETWORK CONFIGURATION
#-----------------------------------------------------------------------------------
# Docker network name (OK TO LEAVE AS IS)
# All containers will be connected to this network to communicate with each other
NETWORK_NAME = 'toolbox_network'
#-----------------------------------------------------------------------------------
# 1PASSWORD CONFIGURATION - IMPORTANT TO REVIEW
#-----------------------------------------------------------------------------------
# 1Password vault ID where secrets are stored (CHANGE THIS to your vault ID)
# Find this in 1Password by going to Settings > Vaults and looking at the vault's URL
OP_VAULT = 'ao6pgbthqnu4expub6pdb4z3oa'
#-----------------------------------------------------------------------------------
# UPTIME ROBOT CONFIGURATION - OPTIONAL
#-----------------------------------------------------------------------------------
# Configuration for Uptime Robot healthcheck (CHANGE THIS to your Uptime Robot settings)
# Retrieves the URL from 1Password to ping the Uptime Robot monitoring service
# To disable Uptime Robot, set this to nil or remove this section entirely
UPTIME_ROBOT = {
url_source: { type: '1password', item: 'UptimeRobot', field: 'url' }
}
# UPTIME_ROBOT = nil # Uncomment this line and comment out the above to disable Uptime Robot
#-----------------------------------------------------------------------------------
# DOCKER SERVICES - CUSTOMIZE THESE BASED ON YOUR NEEDS
#-----------------------------------------------------------------------------------
# List of Docker containers to run
# Each entry defines a container configuration
DOCKER_SERVICES = [
# PostgreSQL Database (MODIFY OR REMOVE if not needed)
{
name: 'postgres', # Container name
image: 'pgvector/pgvector:pg17', # Docker image to use (specific version recommended)
ports: ['5432:5432'], # Port mapping (host:container)
volumes: ["#{DATA_DIR}/postgres:/var/lib/postgresql/data"], # Data persistence
environment: { # Environment variables
# Credentials retrieved from 1Password (CHANGE THESE to your 1Password items)
POSTGRES_USER: { type: '1password', item: 'Postgres Docker', field: 'username' },
POSTGRES_PASSWORD: { type: '1password', item: 'Postgres Docker', field: 'password' },
POSTGRES_MAX_CONNECTIONS: '1000'
},
auto_update: true # Whether to auto-update when image tag changes
},
{
name: 'mysql', # Container name
image: 'mysql:8.0', # Docker image to use (specific version recommended)
ports: ['3306:3306'], # Port mapping (host:container)
volumes: ["#{DATA_DIR}/mysql:/var/lib/mysql"], # Data persistence
environment: { # Environment variables
# Credentials retrieved from 1Password (CHANGE THESE to your 1Password items)
MYSQL_ROOT_PASSWORD: { type: '1password', item: 'MySQL Docker', field: 'password' },
MYSQL_USER: { type: '1password', item: 'MySQL Docker', field: 'username' },
MYSQL_PASSWORD: { type: '1password', item: 'MySQL Docker', field: 'password' },
MYSQL_DATABASE: 'ghost' # Default database name
},
auto_update: true # Whether to auto-update when image tag changes
},
{
name: 'ghost', # Container name
image: 'ghost:6.19.1', # Docker image to use (specific version recommended)
ports: ['2368:2368'], # Port mapping (host:container)
volumes: ["#{DATA_DIR}/ghost:/var/lib/ghost/content"], # Data persistence
environment: { # Environment variables
# CHANGE THESE URLs to your domain
url: 'https://www.contraption.co', # Public URL for your Ghost site
admin__url: 'https://write.contraption.co', # Admin URL for your Ghost site
# Database configuration (linked to MySQL container)
database__client: 'mysql',
database__connection__host: 'mysql',
database__connection__user: { type: '1password', item: 'MySQL Docker', field: 'username' },
database__connection__password: { type: '1password', item: 'MySQL Docker', field: 'password' },
database__connection__database: 'ghost',
# Mail configuration (CHANGE THESE to your mail provider)
mail__transport: 'SMTP',
mail__options__service: 'Mailgun',
mail__options__host: 'smtp.mailgun.org',
mail__options__port: '465',
mail__options__secure: 'true',
# Mail credentials from 1Password (CHANGE THESE to your 1Password items)
mail__options__auth__user: { type: '1password', item: 'Mailgun', field: 'username' },
mail__options__auth__pass: { type: '1password', item: 'Mailgun', field: 'password' },
# CHANGE THIS to your email address
mail__from: "'Philip I. Thomas' <philip@contraption.co>"
},
auto_update: true, # Whether to auto-update when image tag changes
depends_on: ['mysql'] # This container depends on MySQL
},
]
#-----------------------------------------------------------------------------------
# GIT-BASED SERVICES - CUSTOMIZE THESE BASED ON YOUR NEEDS
#-----------------------------------------------------------------------------------
# Services that are based on Git repositories
# These can be code that gets built and deployed, or code that runs in containers
GIT_SERVICES = [
{
name: 'ghost_theme', # Service name
repo_url: 'git@github.com:contraptionco/contraption-ghost-theme.git', # Git repo
local_path: "#{CODE_DIR}/contraption-ghost-theme", # Where to clone the repo
deploy_path: "#{DATA_DIR}/ghost/themes/contraption-ghost-theme", # Where to deploy the built theme (optional)
build_cmd: 'asdf install && /Users/philip/.asdf/shims/npm install && /Users/philip/.asdf/shims/npm run build', # Build command
auto_update: true, # Whether to auto-update when repo changes
after_deploy: { type: 'restart_service', service: 'ghost' } # Action after deployment
},
{
name: 'postcard', # Service name
repo_url: 'git@github.com:contraptionco/postcard.git', # CHANGE THIS to your repository
local_path: "#{CODE_DIR}/postcard", # Where to clone the repo
# Environment configuration from 1Password
env_config: { type: '1password', item: 'Postcard', field: 'env' },
container_config: { # Container configuration after build
image_name: 'postcard', # Docker image name to create
ports: ['3000:3000'], # Port mapping (host:container)
environment: { # Environment variables
DATABASE_URL: { type: '1password', item: 'Postcard', field: 'DATABASE_URL' },
RAILS_MASTER_KEY: { type: '1password', item: 'Postcard', field: 'RAILS_MASTER_KEY' },
ADMIN_CHAT_URL: { type: '1password', item: 'Postcard', field: 'ADMIN_CHAT_URL' },
APP_MODE: 'MULTIUSER',
RAILS_ENV: 'production' # Environment setting
},
cmd: 'bundle exec puma -C config/puma.rb' # Command to run in the container
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'junk-drawer', # Service name
repo_url: 'git@github.com:contraptionco/junk-drawer.git', # CHANGE THIS to your repository
local_path: "#{CODE_DIR}/junk-drawer", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'junk-drawer', # Docker image name to create
ports: ['4001:3000'], # Port mapping (host:container)
environment: { # Environment variables
DATABASE_URL: { type: '1password', item: 'junk-drawer', field: 'DATABASE_URL' },
RAILS_MASTER_KEY: { type: '1password', item: 'junk-drawer', field: 'RAILS_MASTER_KEY' },
RAILS_ENV: 'production' # Environment setting
},
cmd: 'bundle exec puma -C config/puma.rb' # Command to run in the container
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'plausible', # Service name
repo_url: 'https://github.com/plausible/community-edition', # Repo URL (public repo)
local_path: "#{DATA_DIR}/plausible/plausible-ce", # Where to clone the repo
branch: 'v3.1.0', # Specific branch or tag to use
# Environment configuration from 1Password (CHANGE THIS to your 1Password item)
env_config: { type: '1password', item: 'Plausible', field: 'env' },
# Custom docker-compose override
compose_override: {
services: {
plausible: {
ports: ['127.0.0.1:8000:8000'] # Port mapping for the service
# Cloudflare connects to port 8000 to serve:
# telegraph.contraption.co
}
}
},
auto_update: false # Whether to auto-update when repo changes
},
{
name: 'quesogpt', # Service name
repo_url: 'git@github.com:contraptionco/quesogpt.git', # Git repo
local_path: "#{CODE_DIR}/quesogpt", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'quesogpt', # Docker image name to create
ports: ['3001:3000'], # Map host 3001 -> container 3000
environment: { # Environment variables from 1Password
CHROMA_TENANT: { type: '1password', item: 'quesogpt', field: 'CHROMA_TENANT' },
CHROMA_DATABASE: { type: '1password', item: 'quesogpt', field: 'CHROMA_DATABASE' },
CHROMA_API_KEY: { type: '1password', item: 'quesogpt', field: 'CHROMA_API_KEY' },
OPENAI_API_KEY: { type: '1password', item: 'quesogpt', field: 'OPENAI_API_KEY' },
CHROMA_URL: { type: '1password', item: 'quesogpt', field: 'CHROMA_URL' }
}
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'fonts', # Service name
repo_url: 'git@github.com:contraptionco/fonts.git', # Git repo
local_path: "#{CODE_DIR}/fonts", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'fonts', # Docker image name to create
ports: ['3002:80'] # Map host 3002 -> container 80 (nginx default)
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'philipithomas-fonts', # Service name
repo_url: 'git@github.com:philipithomas/fonts.git', # Git repo
local_path: "#{CODE_DIR}/philipithomas-fonts", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'philipithomas-fonts', # Docker image name to create
ports: ['3004:80'] # Map host 3004 -> container 80 (nginx default)
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'wedding-next', # Service name
repo_url: 'git@github.com:philipithomas/wedding-next.git', # Git repo
local_path: "#{CODE_DIR}/wedding-next", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'wedding-next', # Docker image name to create
ports: ['3006:3000'] # Map host 3006 -> container 3000
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'redirects', # Service name
repo_url: 'git@github.com:philipithomas/redirects.git', # Git repo
local_path: "#{CODE_DIR}/redirects", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'redirects', # Docker image name to create
ports: ['3005:80'] # Map host 3005 -> container 80 (nginx default)
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'printing-press', # Service name
repo_url: 'git@github.com:philipithomas/printing-press.git', # Git repo
local_path: "#{CODE_DIR}/printing-press", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'printing-press', # Docker image name to create
ports: ['4242:8080'], # Map host 4242 -> container 8080
environment: { # Environment variables from 1Password
DATABASE_URL: { type: '1password', item: 'printing-press', field: 'DATABASE_URL' },
M2M_API_KEY: { type: '1password', item: 'printing-press', field: 'M2M_API_KEY' },
AWS_ACCESS_KEY_ID: { type: '1password', item: 'printing-press', field: 'AWS_ACCESS_KEY_ID' },
AWS_SECRET_ACCESS_KEY: { type: '1password', item: 'printing-press', field: 'AWS_SECRET_ACCESS_KEY' },
AWS_REGION: { type: '1password', item: 'printing-press', field: 'AWS_REGION' },
SES_FROM_EMAIL: { type: '1password', item: 'printing-press', field: 'SES_FROM_EMAIL' },
EMAIL_BACKEND: 'ses',
SITE_URL: 'https://philipithomas.com',
HOST: '0.0.0.0',
PORT: '8080'
}
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'bully-pulpit', # Service name
repo_url: 'git@github.com:philipithomas/bully-pulpit.git', # Git repo
local_path: "#{CODE_DIR}/bully-pulpit", # Where to clone the repo
env_config: { type: '1password', item: 'bully-pulpit', field: 'env' },
container_config: { # Container configuration after build
image_name: 'bully-pulpit', # Docker image name to create
ports: ['4243:3000'] # Map host 4243 -> container 3000
},
auto_update: true # Whether to auto-update when repo changes
},
{
name: 'trivet', # Service name
repo_url: 'git@github.com:contraptionco/trivet.git', # Git repo
local_path: "#{CODE_DIR}/trivet", # Where to clone the repo
container_config: { # Container configuration after build
image_name: 'trivet', # Docker image name to create
ports: ['3003:3000'], # Map host 3003 -> container 3000 (Trivet default)
environment: { # Environment variables from 1Password
DATABASE_URL: { type: '1password', item: 'trivet', field: 'DATABASE_URL' },
GOOGLE_OAUTH_CLIENT_ID: { type: '1password', item: 'trivet', field: 'GOOGLE_OAUTH_CLIENT_ID' },
GOOGLE_OAUTH_CLIENT_SECRET: { type: '1password', item: 'trivet', field: 'GOOGLE_OAUTH_CLIENT_SECRET' },
TRIVET_SESSION_SECRET: { type: '1password', item: 'trivet', field: 'TRIVET_SESSION_SECRET' },
TRIVET_PUBLIC_BASE_URL: { type: '1password', item: 'trivet', field: 'TRIVET_PUBLIC_BASE_URL' },
PORT: '3000'
}
},
auto_update: true # Whether to auto-update when repo changes
}
]
#-----------------------------------------------------------------------------------
# SCRIPTS - OPTIONAL AUTOMATIONS
#-----------------------------------------------------------------------------------
SCRIPTS = [
{
name: 'ghost_backup', # Script name
type: 'ruby', # Script type (:ruby or :shell)
description: 'Back up Ghost data and metadata to ghost-backup repository',
require: 'scripts/ghost_backup', # Relative path to the script file
class_name: 'Scripts::GhostBackup', # Runner class
method: :run, # Method to execute
enabled: true # Toggle script without removing config
},
{
name: 'postgres_backup',
type: 'ruby',
description: 'Export Postgres databases and upload to S3',
require: 'scripts/postgres_backup',
class_name: 'Scripts::PostgresBackup',
method: :run,
enabled: true
}
]
#-----------------------------------------------------------------------------------
# SYSTEM SERVICES - CUSTOMIZE THESE BASED ON YOUR NEEDS
#-----------------------------------------------------------------------------------
# System-level services to manage (not in Docker)
SYSTEM_SERVICES = [
# Netdata monitoring (MODIFY OR REMOVE if not needed)
{
name: 'netdata', # Service name
type: 'system', # Service type
cmd: '/opt/homebrew/opt/netdata/sbin/netdata', # Command path (CHANGE if path differs)
detection: 'pgrep -f "/opt/homebrew/opt/netdata/sbin/netdata"', # How to detect if running
start_cmd: '/opt/homebrew/opt/netdata/sbin/netdata -D' # Command to start the service
# Cloudflare connects to port 19999 to serve:
# toolbox.contraption.co
}
]
#-----------------------------------------------------------------------------------
# CLOUDFLARE TUNNEL CONFIGURATION - REQUIRED
#-----------------------------------------------------------------------------------
# Cloudflare tunnel settings (REQUIRED - the entire toolbox depends on this)
# You must have a Cloudflare tunnel configured for this to work properly
TUNNEL_CONFIG = {
# Path to the tunnel config file (CHANGE THIS to your tunnel config path)
config_path: "#{CODE_DIR}/toolbox/config.yml",
# Name of the tunnel (CHANGE THIS to your tunnel name)
tunnel_name: 'toolbox',
# Path to log file (OK TO LEAVE AS IS)
log_file: "#{CODE_DIR}/toolbox/tunnel.log"
}
#-----------------------------------------------------------------------------------
# TELEMETRY CONFIGURATION - OPTIONAL
#-----------------------------------------------------------------------------------
# Set to true to disable anonymous telemetry collection
# This helps us understand how many people are using Toolbox
DISABLE_ANONYMOUS_TELEMETRY = false
end