forked from PowerDNS-Admin/PowerDNS-Admin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lukas
committed
Mar 8, 2023
1 parent
4933351
commit d055fd8
Showing
6 changed files
with
144 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
This discribes how to debug the buildprocess | ||
|
||
|
||
docker-compose.yml | ||
|
||
``` | ||
version: "3" | ||
services: | ||
app: | ||
image: powerdns/custom | ||
container_name: powerdns | ||
restart: always | ||
build: | ||
context: git | ||
dockerfile: docker/Dockerfile | ||
network_mode: "host" | ||
logging: | ||
driver: json-file | ||
options: | ||
max-size: 50m | ||
environment: | ||
- BIND_ADDRESS=127.0.0.1:8082 | ||
- SECRET_KEY='VerySecret' | ||
- SQLALCHEMY_DATABASE_URI=mysql://pdnsadminuser:[email protected]/powerdnsadmin | ||
- GUNICORN_TIMEOUT=60 | ||
- GUNICORN_WORKERS=2 | ||
- GUNICORN_LOGLEVEL=DEBUG | ||
- OFFLINE_MODE=False | ||
- CSRF_COOKIE_SECURE=False | ||
``` | ||
|
||
Create a git folder in the location of the `docker-compose.yml` and clone the repo into it | ||
|
||
``` | ||
mkdir git | ||
cd git | ||
git clone https://github.com/PowerDNS-Admin/PowerDNS-Admin.git . | ||
``` | ||
|
||
In case you are behind an SSL Filter like me, you can add the following to each stage of the `git/docker/Dockerfile` | ||
|
||
This installs the command `update-ca-certificates` from the alpine repo and adds an ssl cert to the trust chain, make sure you are getting the right version in case the base image version changes | ||
|
||
``` | ||
RUN mkdir /tmp-pkg && cd /tmp-pkg && wget http://dl-cdn.alpinelinux.org/alpine/v3.17/main/x86_64/ca-certificates-20220614-r4.apk && apk add --allow-untrusted --no-network --no-cache /tmp-pkg/ca-certificates-20220614-r4.apk || true | ||
RUN rm -rf /tmp/pkg | ||
COPY MyCustomCerts.crt /usr/local/share/ca-certificates/MyCustomCerts.crt | ||
RUN update-ca-certificates | ||
COPY pip.conf /etc/pip.conf | ||
``` | ||
|
||
`MyCustomCerts.crt` and `pip.conf` have to be placed inside the `git` folder. | ||
|
||
The content of `pip.conf` is: | ||
|
||
``` | ||
[global] | ||
cert = /usr/local/share/ca-certificates/MyCustomCerts.crt | ||
``` | ||
|
||
For easier debugging you can change the `CMD` of the `Dockerfile` to `CMD ["tail","-f", "/dev/null"]` though I expect you to be fluent in Docker in case you wish to debug |
73 changes: 73 additions & 0 deletions
73
docs/wiki/web-server/Running-Docker-Apache-Reverseproxy.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
This describes how to run Apache2 on the host system with a reverse proxy directing to the docker container | ||
|
||
This is usually used to add ssl certificates and prepend a subdirectory | ||
|
||
The network_mode host settings is not neccessary but used for ldap availability in this case | ||
|
||
|
||
docker-compose.yml | ||
|
||
``` | ||
version: "3" | ||
services: | ||
app: | ||
image: powerdnsadmin/pda-legacy:latest | ||
container_name: powerdns | ||
restart: always | ||
network_mode: "host" | ||
logging: | ||
driver: json-file | ||
options: | ||
max-size: 50m | ||
environment: | ||
- BIND_ADDRESS=127.0.0.1:8082 | ||
- SECRET_KEY='NotVerySecret' | ||
- SQLALCHEMY_DATABASE_URI=mysql://pdnsadminuser:[email protected]/powerdnsadmin | ||
- GUNICORN_TIMEOUT=60 | ||
- GUNICORN_WORKERS=2 | ||
- GUNICORN_LOGLEVEL=DEBUG | ||
- OFFLINE_MODE=False | ||
- CSRF_COOKIE_SECURE=False | ||
- SCRIPT_NAME=/powerdns | ||
``` | ||
|
||
After running the Container create the static directory and populate | ||
|
||
``` | ||
mkdir -p /var/www/powerdns | ||
docker cp powerdns:/app/powerdnsadmin/static /var/www/powerdns/ | ||
chown -R root:www-data /var/www/powerdns | ||
``` | ||
|
||
Adjust the static reference, static/assets/css has a hardcoded reference | ||
|
||
``` | ||
sed -i 's/\/static/\/powerdns\/static/' /var/www/powerdns/static/assets/css/* | ||
``` | ||
|
||
Apache Config: | ||
|
||
You can set the SCRIPT_NAME environment using Apache as well, once is sufficient though | ||
|
||
``` | ||
<Location /powerdns> | ||
RequestHeader set X-Forwarded-Proto "https" | ||
RequestHeader set X-Forwarded-Port "443" | ||
RequestHeader set SCRIPT_NAME "/powerdns" | ||
ProxyPreserveHost On | ||
</Location> | ||
ProxyPass /powerdns/static ! | ||
ProxyPass /powerdns http://127.0.0.1:8082/powerdns | ||
ProxyPassReverse /powerdns http://127.0.0.1:8082/powerdns | ||
Alias /powerdns/static "/var/www/powerdns/static" | ||
<Directory "/var/www/powerdns/static"> | ||
Options None | ||
#Options +Indexes | ||
AllowOverride None | ||
Order allow,deny | ||
Allow from all | ||
</Directory> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,3 +42,4 @@ rjsmin==1.2.1 | |
webcolors==1.12 | ||
werkzeug==2.1.2 | ||
zipp==3.11.0 | ||
rcssmin==1.1.1 |