Skip to content

Commit 3cb2f0d

Browse files
committed
New development environment that uses Tailscale & Caddy
1 parent 31db893 commit 3cb2f0d

File tree

7 files changed

+147
-3
lines changed

7 files changed

+147
-3
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:8.3.2-fpm-alpine
1+
FROM php:8.3.3-fpm-alpine
22

33
LABEL maintainer="Jim Winstead <jimw@trainedmonkey.com>"
44

@@ -30,11 +30,13 @@ RUN apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
3030
zip \
3131
&& apk del -dev ${PHPIZE_DEPS}
3232

33+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
34+
3335
WORKDIR /app
3436

3537
COPY . /app
3638

37-
COPY log.conf /usr/local/etc/php-fpm.d/
39+
COPY config/log.conf /usr/local/etc/php-fpm.d/
3840

3941
RUN curl -sS https://getcomposer.org/installer | php \
4042
&& mv composer.phar /usr/local/bin/ \

config/Caddyfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
:80 {
2+
# compress stuff
3+
encode zstd gzip
4+
5+
# our root is in /srv
6+
root * /srv/site
7+
8+
# pass everything else to php
9+
php_fastcgi talapoin:9000 {
10+
root /app/site
11+
}
12+
13+
file_server
14+
}

config/log.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
access.format = "%{%FT%T%z}t %{REMOTE_ADDR}e %m %{REQUEST_URI}e %s %{mili}d"

config/tailscale/talapoin.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"TCP": {
3+
"443": {
4+
"HTTPS": true
5+
}
6+
},
7+
"Web": {
8+
"${TS_CERT_DOMAIN}:443": {
9+
"Handlers": {
10+
"/": {
11+
"Proxy": "http://caddy:80"
12+
}
13+
}
14+
}
15+
},
16+
"AllowFunnel": {
17+
"${TS_CERT_DOMAIN}:443": false
18+
}
19+
}

docker-compose.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
version: '3.4'
2+
3+
services:
4+
tailscale:
5+
image: tailscale/tailscale:latest
6+
hostname: talapoin
7+
env_file: ./.env
8+
environment:
9+
- TS_SERVE_CONFIG=/config/talapoin.json
10+
- TS_STATE_DIR=/var/lib/tailscale
11+
volumes:
12+
- tailscalestate:/var/lib/tailscale
13+
- ./config/tailscale:/config
14+
- /dev/net/tun:/dev/net/tun
15+
cap_add:
16+
- net_admin
17+
- sys_module
18+
restart: unless-stopped
19+
20+
caddy:
21+
image: caddy:2.7.6
22+
volumes:
23+
- ./config:/etc/caddy
24+
- ./:/srv
25+
- caddy_data:/data
26+
- caddy_config:/config
27+
restart: unless-stopped
28+
29+
talapoin:
30+
image: jimwins/talapoin
31+
build: ./
32+
env_file: ./.env
33+
expose:
34+
- "9000"
35+
volumes:
36+
- .:/app
37+
restart: unless-stopped
38+
39+
db:
40+
image: mysql:8.0.30
41+
env_file: ./.env
42+
# old password auth so sphinx can access it
43+
command: [ mysqld, --local-infile=1, --default_authentication_plugin=mysql_native_password ]
44+
expose:
45+
- "3306"
46+
volumes:
47+
- ./db/init:/docker-entrypoint-initdb.d
48+
- mysql_data:/var/lib/mysql
49+
restart: unless-stopped
50+
51+
meilisearch:
52+
image: getmeili/meilisearch:v1.6
53+
env_file: ./.env
54+
volumes:
55+
- meilisearch_data:/meili_data
56+
expose:
57+
- "7700"
58+
restart: unless-stopped
59+
60+
# elasticsearch:
61+
# image: docker.elastic.co/elasticsearch/elasticsearch:8.12.0
62+
# environment:
63+
# - node.name=muck-node
64+
# - discovery.type=single-node
65+
# - cluster.name=muck-es-data-cluster
66+
# - bootstrap.memory_lock=true
67+
# - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
68+
# volumes:
69+
# - elasticsearchdata:/usr/share/elasticsearch/data
70+
# expose:
71+
# - "9200"
72+
# restart: always
73+
74+
# sphinxsearch:
75+
# image: macbre/sphinxsearch:3.2.1
76+
# links:
77+
# - db
78+
# env_file: ./config
79+
# expose:
80+
# - "9306"
81+
# volumes:
82+
# - ./search:/opt/sphinx/conf
83+
# - searchdata:/var/data
84+
# restart: always
85+
86+
87+
# backup:
88+
# build: backup
89+
# env_file: ./config
90+
# environment:
91+
# - MYSQL_HOST=db
92+
# - SCHEDULE=0 0 20 * * *
93+
# restart: always
94+
95+
volumes:
96+
mysql_data:
97+
caddy_data:
98+
caddy_config:
99+
# searchdata:
100+
# elasticsearchdata:
101+
meilisearch_data:
102+
tailscalestate:

log.conf

Lines changed: 0 additions & 1 deletion
This file was deleted.

sample.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
TS_AUTHKEY="tskey-client-{something}?ephemeral=false"
2+
TS_EXTRA_ARGS="--advertise-tags=tag:container --reset"
3+
MYSQL_ROOT_PASSWORD="whatever-you-want"
4+
MYSQL_DATABASE="database"
5+
MYSQL_USER="user"
6+
MYSQL_PASSWORD="password"
7+
MEILI_MASTER_KEY="some-sort-of-key"

0 commit comments

Comments
 (0)