Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5fb569f

Browse files
Added config for xdebug remote and docker ssl domain example
1 parent d8d0dbe commit 5fb569f

File tree

5 files changed

+96
-2
lines changed

5 files changed

+96
-2
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[Xdebug]
2+
3+
# Automatically start debugger on every request
4+
xdebug.remote_enable=1
5+
xdebug.remote_autostart=1
6+
xdebug.remote_port=9000
7+
8+
# Send all debug requests to 127.0.0.1, remote_connect_back should be turned off
9+
xdebug.remote_connect_back=0
10+
xdebug.remote_host=127.0.0.1
11+
12+
# Log all xdebug requests to see is it working correctly
13+
xdebug.remote_log=/var/log/xdebug/remote.log
14+
15+
# Load extension
16+
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so

‎config-dev/supervisord.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,25 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
2121
[supervisorctl]
2222
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
2323

24+
;Start sshd
25+
[program:sshd]
26+
command=/usr/sbin/sshd -D
27+
autostart=true
28+
autorestart=true
29+
priority=3
30+
stdout_events_enabled=true
31+
stderr_events_enabled=true
32+
stdout_logfile=/dev/stdout
33+
stdout_logfile_maxbytes=0
34+
2435
;Start php-fpm
2536
[program:php-fpm]
2637
command=/usr/local/sbin/php-fpm -F
2738
autostart=true
2839
autorestart=true
2940
priority=5
41+
stdout_events_enabled=true
42+
stderr_events_enabled=true
3043
stdout_logfile=/dev/stdout
3144
stdout_logfile_maxbytes=0
3245

‎custom/phpdev/Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,22 @@ RUN set -ex \
4747
sodium calendar simplexml tidy xmlrpc \
4848
&& CFLAGS="-I/usr/src/php" docker-php-ext-install xmlreader
4949

50+
# Install sshd
51+
RUN apk --update add --no-cache openssh bash \
52+
&& sed -i s/#PermitRootLogin.*/PermitRootLogin\ yes/ /etc/ssh/sshd_config \
53+
&& echo "root:root" | chpasswd \
54+
&& rm -rf /var/cache/apk/*
55+
RUN sed -ie 's/#Port 22/Port 22/g' /etc/ssh/sshd_config
56+
RUN sed -ri 's/#HostKey \/etc\/ssh\/ssh_host_key/HostKey \/etc\/ssh\/ssh_host_key/g' /etc/ssh/sshd_config
57+
RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_rsa_key/HostKey \/etc\/ssh\/ssh_host_rsa_key/g' /etc/ssh/sshd_config
58+
RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_dsa_key/HostKey \/etc\/ssh\/ssh_host_dsa_key/g' /etc/ssh/sshd_config
59+
RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ecdsa_key/HostKey \/etc\/ssh\/ssh_host_ecdsa_key/g' /etc/ssh/sshd_config
60+
RUN sed -ir 's/#HostKey \/etc\/ssh\/ssh_host_ed25519_key/HostKey \/etc\/ssh\/ssh_host_ed25519_key/g' /etc/ssh/sshd_config
61+
RUN /usr/bin/ssh-keygen -A
62+
RUN ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_key
63+
5064
# Expose port 80
5165
EXPOSE 80
66+
67+
# Expose port 22
68+
EXPOSE 22

‎docker-ssl.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
3+
# Example ssl domain on local machine with docker
4+
# Please map ssldomain.local to 127.0.0.1 before running the script
5+
6+
# Start nginx proxy container
7+
docker run -d -p 80:80 -p 443:443 \
8+
--name nginx-proxy \
9+
-v /etc/nginx/certs \
10+
-v /etc/nginx/vhost.d \
11+
-v /usr/share/nginx/html \
12+
-v /var/run/docker.sock:/tmp/docker.sock:ro \
13+
--label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy \
14+
jwilder/nginx-proxy
15+
16+
# Start nginx ssl companion container
17+
docker run -d \
18+
--name nginx-ssl-companion \
19+
-v /var/run/docker.sock:/var/run/docker.sock:ro \
20+
--volumes-from nginx-proxy \
21+
jrcs/letsencrypt-nginx-proxy-companion
22+
23+
docker exec nginx-ssl-companion \
24+
openssl req -x509 \
25+
-newkey rsa:4096 \
26+
-sha256 \
27+
-nodes \
28+
-days 365 \
29+
-subj '/CN=ssldomain.local' \
30+
-keyout /etc/nginx/certs/ssldomain.local.key \
31+
-out /etc/nginx/certs/ssldomain.local.crt
32+
33+
docker exec nginx-proxy nginx -s reload
34+
35+
# Start container listening on domain
36+
docker run -d -e "VIRTUAL_HOST=ssldomain.local" --name nginx-ssl-test oak3docker/phpdev
37+
38+
# Test ssl connection
39+
curl -s -D -k -v "https://ssldomain.local" -o /dev/null

‎init-scripts/container.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Remove base image ssh key
44
if [ -f "/root/.ssh/base_id_rsa" ] ;
55
then
6-
rm -rf /root/.ssh/base_id_rsa*
6+
rm -rf /root/.ssh/base_id_rsa*
77
fi
88

99
### Retrieve public ssh key (id_rsa.pub)
@@ -79,17 +79,26 @@ cd /var/www
7979
# Copy env file
8080

8181
if [ -f "/var/www/.env.example" ] ; then
82+
echo "Copying .env.example to .env"
8283
cp -n .env.example .env
8384
fi
8485

8586
if [ -f "/var/www/.env.dist" ] ; then
8687
cp -n .env.dist .env
8788
fi
8889

89-
#Run composer install
90+
# Create Xdebug log file
91+
mkdir -p /var/log/xdebug
92+
touch /var/log/xdebug/remote.log && chmod 777 /var/log/xdebug/remote.log
93+
94+
# Run composer install
9095
if [ -f "/var/www/composer.json" ] ;
9196
then
9297

98+
echo "::::::::::::::::::::::::::::::::::::::::::::";
99+
echo "Installing dependencies ... "
100+
echo "::::::::::::::::::::::::::::::::::::::::::::";
101+
93102
if [ -n "$APP_ENV" ] ;
94103
then
95104

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /