Browse Source

proxy

master
root Apostolos 5 years ago
parent
commit
5681a1da63
  1. 28
      default-ssl.conf
  2. 59
      docker-apache-proxy-ssl/Dockerfile
  3. 1
      docker-apache-proxy-ssl/Dockerfile.sh
  4. 13
      docker-apache-proxy-ssl/apache-proxy-start.sh
  5. 30
      git-proxy.yaml
  6. 2
      git-proxy.yaml.sh
  7. 4
      git.yaml
  8. 1
      git.yaml.sh

28
default-ssl.conf

@ -0,0 +1,28 @@
<VirtualHost *:3001>
ServerName git.swarmlab.io
SSLEngine On
SSLCertificateFile /opt/ssl/yourcertificate.crt
SSLCertificateKeyFile /opt/ssl/yourcertificate.key
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLProxyEngine on
<Location />
ProxyPass / http://localhost:3000/ nocanon
ProxyPassReverse / http://localhost:3000/
</Location>
<Directory /var/www/html/>
ProxyPreserveHost On
ProxyRequests off
AllowEncodedSlashes NoDecode
ProxyPass / https://localhost:3000/ nocanon
ProxyPassReverse / https://localhost:3000/
Options Indexes FollowSymLinks MultiViews
#AddHandler markdown .md
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

59
docker-apache-proxy-ssl/Dockerfile

@ -0,0 +1,59 @@
#Choose Debian
FROM debian:jessie
MAINTAINER DiouxX "github@diouxx.be"
RUN echo "deb http://ftp.de.debian.org/debian stretch main" >> /etc/apt/sources.list
#Don't ask questions during install
ENV DEBIAN_FRONTEND noninteractive
#Install apache2 and enable proxy mode
RUN apt update \
&& apt -y install \
apache2 \
&& rm -rf /var/lib/apt/lists/*
#libapache2-mod-auth-cas \
#php7.0-mysql \
#php7.0-opcache \
#php7.0-common \
#curl \
#php7.0-mbstring \
#php7.0-mcrypt \
#php7.0-cli \
#php7.0-intl \
#php7.0-json \
#php7.0-xsl \
#php7.0-curl \
#php7.0-memcached \
#php7.0-readline \
#php7.0-recode \
#php7.0-fpm \
#php7.0 \
#libapache2-mod-php7.0 libapache2-mod-php \
RUN a2enmod proxy \
&& a2enmod proxy_http \
&& a2enmod ssl \
&& a2enmod headers \
&& a2enmod rewrite \
&& a2enmod proxy_wstunnel \
&& service apache2 stop
#&& a2enmod auth_cas \
#&& a2enmod php7.0 \
#Ports
EXPOSE 80 443 8080
#Volumes
VOLUME /opt/proxy-conf
VOLUME /opt/ssl
VOLUME /opt/logs
VOLUME /opt/www
VOLUME /opt/private
#Launch Apache2 on FOREGROUND
COPY apache-proxy-start.sh /opt/
RUN chmod +x /opt/apache-proxy-start.sh
ENTRYPOINT ["/opt/apache-proxy-start.sh"]

1
docker-apache-proxy-ssl/Dockerfile.sh

@ -0,0 +1 @@
docker build -t registry.vlabs.uniwa.gr:5080/vlab-apache2-proxy-ssl -t registry.vlabs.uniwa.gr:5043/vlab-apache2-proxy-ssl .

13
docker-apache-proxy-ssl/apache-proxy-start.sh

@ -0,0 +1,13 @@
#!/bin/bash
#Copy virtualhost on apache directory
cp /opt/proxy-conf/*.conf /etc/apache2/sites-available/
#List site and enable
ls /etc/apache2/sites-available/ -1A | a2ensite *.conf
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
#Launch Apache on Foreground
/usr/sbin/apache2ctl -D FOREGROUND

30
git-proxy.yaml

@ -0,0 +1,30 @@
version: "3.3"
services:
server_proxy:
#image: registry.vlabs.uniwa.gr:5043/swarmlab-apache2-markdown
image: registry.vlabs.uniwa.gr:5080/vlab-apache2-proxy-ssl:latest
networks:
- git-net
deploy:
replicas: 1
placement:
constraints:
- node.id == ${REGISTERid}
ports:
- 3000:443
- 3043:8080
volumes:
- "/var/lib/swarmlab.io/gitproxy/ssl:/opt/ssl"
- "/var/lib/swarmlab.io/gitproxy/conf:/opt/proxy-conf"
- "/var/lib/swarmlab.io/gitproxy/apache2/apache2.conf:/etc/apache2/apache2.conf"
- "/var/lib/swarmlab.io/gitproxy/apache2/ports.conf:/etc/apache2/ports.conf"
- "/var/lib/swarmlab.io/gitproxy/www:/opt/www"
- "/var/lib/swarmlab.io/gitproxy/private:/opt/private"
networks:
git-net:

2
git-proxy.yaml.sh

@ -0,0 +1,2 @@
docker service rm git_server_proxy
env REGISTERid=c50xzv12mz3cux1mcdz4ypznc docker stack deploy -c git-proxy.yaml git

4
git.yaml

@ -6,7 +6,7 @@ networks:
services:
server:
image: gitea/gitea:1.9
image: gitea/gitea:1.9.4
environment:
- USER_UID=1002
- USER_GID=1002
@ -21,7 +21,7 @@ services:
volumes:
- /var/lib/gitea:/data
ports:
- "3000:3000"
- "3001:3000"
- "3080:3080"
- "127.0.0.1:2222:22"
depends_on:

1
git.yaml.sh

@ -1 +1,2 @@
docker service rm git_db git_server
env REGISTERid=c50xzv12mz3cux1mcdz4ypznc docker stack deploy -c git.yaml git

Loading…
Cancel
Save