forked from hazza/resourcespace-docker
Add certbot with cloudflare dns challenge
This commit is contained in:
3
.env
Normal file
3
.env
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
RS_PUBLISHED_DOMAIN=dam.internal.yel.or.id
|
||||||
|
RS_SERVERADMIN=hendra@yel.or.id
|
||||||
|
DNS_CLOUDFLARE_API_TOKEN=3WedMWHhoDPxge5yMPJgQPFhRXCTp6zpasTIlaIu
|
34
Dockerfile
34
Dockerfile
@@ -30,7 +30,9 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libopencv-dev \
|
libopencv-dev \
|
||||||
python3-opencv \
|
python3-opencv \
|
||||||
python3 \
|
python3 \
|
||||||
python3-pip \
|
certbot \
|
||||||
|
python3-certbot-dns-cloudflare \
|
||||||
|
python3-certbot-apache \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
@@ -39,17 +41,39 @@ RUN sed -i -e "s/upload_max_filesize\s*=\s*2M/upload_max_filesize = 100M/g" /etc
|
|||||||
&& sed -i -e "s/max_execution_time\s*=\s*30/max_execution_time = 300/g" /etc/php/8.3/apache2/php.ini \
|
&& sed -i -e "s/max_execution_time\s*=\s*30/max_execution_time = 300/g" /etc/php/8.3/apache2/php.ini \
|
||||||
&& sed -i -e "s/memory_limit\s*=\s*128M/memory_limit = 1G/g" /etc/php/8.3/apache2/php.ini
|
&& sed -i -e "s/memory_limit\s*=\s*128M/memory_limit = 1G/g" /etc/php/8.3/apache2/php.ini
|
||||||
|
|
||||||
RUN printf '<Directory /var/www/>\n\
|
RUN mkdir -p ~/.secrets/certbot \
|
||||||
|
touch ~/.secrets/certbot/cloudflare.ini \
|
||||||
|
chmod 600 ~/.secrets/certbot/cloudflare.ini
|
||||||
|
|
||||||
|
RUN printf 'dns_cloudflare_api_token=$DNS_CLOUDFLARE_API_TOKEN' >> ~/.secrets/certbot/cloudflare.ini
|
||||||
|
|
||||||
|
RUN touch /etc/apache2/sites-available/$RS_PUBLISHED_DOMAIN.conf
|
||||||
|
|
||||||
|
RUN printf '<VirtualHost *:80>\n\
|
||||||
|
\tServerName $RS_PUBLISHED_DOMAIN\n\
|
||||||
|
\tServerAdmin $RS_SERVERADMIN\n\
|
||||||
|
\tDocumentRoot /var/www/html\n\
|
||||||
|
\n\
|
||||||
|
\tErrorLog ${APACHE_LOG_DIR}/$RS_PUBLISHED_DOMAIN.error.log\n\
|
||||||
|
\tCustomLog ${APACHE_LOG_DIR}/$RS_PUBLISHED_DOMAIN.access.log combined\n\
|
||||||
|
</VirtualHost>\n'\
|
||||||
|
\n\
|
||||||
|
<Directory /var/www/>\n'\
|
||||||
\tOptions FollowSymLinks\n\
|
\tOptions FollowSymLinks\n\
|
||||||
</Directory>\n'\
|
</VirtualHost>\n'\
|
||||||
>> /etc/apache2/sites-enabled/000-default.conf
|
>> /etc/apache2/sites-available/$RS_PUBLISHED_DOMAIN.conf
|
||||||
|
|
||||||
|
RUN a2ensite $RS_PUBLISHED_DOMAIN.conf \
|
||||||
|
service apache2 reload
|
||||||
|
|
||||||
|
RUN certbot run --apache --non-interactive --agree-tos -m $RS_SERVERADMIN --dns-cloudflare --dns-cloudflare-credentials ~/.secrets/certbot/cloudflare.ini -d $RS_PUBLISHED_DOMAIN
|
||||||
|
|
||||||
ADD cronjob /etc/cron.daily/resourcespace
|
ADD cronjob /etc/cron.daily/resourcespace
|
||||||
|
|
||||||
WORKDIR /var/www/html
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
RUN rm -f index.html \
|
RUN rm -f index.html \
|
||||||
&& svn co -q https://svn.resourcespace.com/svn/rs/releases/10.5 . \
|
&& svn co -q https://svn.resourcespace.com/svn/rs/releases/10.6 . \
|
||||||
&& mkdir -p filestore \
|
&& mkdir -p filestore \
|
||||||
&& chmod 777 filestore \
|
&& chmod 777 filestore \
|
||||||
&& chmod -R 777 include/
|
&& chmod -R 777 include/
|
||||||
|
@@ -6,6 +6,7 @@ services:
|
|||||||
depends_on:
|
depends_on:
|
||||||
- mariadb
|
- mariadb
|
||||||
volumes:
|
volumes:
|
||||||
|
- usrhome:~
|
||||||
- include:/var/www/html/include
|
- include:/var/www/html/include
|
||||||
- filestore:/var/www/html/filestore
|
- filestore:/var/www/html/filestore
|
||||||
- ./testdir:/srv/storage/testdir
|
- ./testdir:/srv/storage/testdir
|
||||||
@@ -14,6 +15,7 @@ services:
|
|||||||
- backend
|
- backend
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
|
- "443:443"
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb
|
image: mariadb
|
||||||
@@ -31,6 +33,7 @@ networks:
|
|||||||
backend:
|
backend:
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
usrhome:
|
||||||
mariadb:
|
mariadb:
|
||||||
include:
|
include:
|
||||||
filestore:
|
filestore:
|
Reference in New Issue
Block a user