chore: simplify docker-compose

This commit is contained in:
Maël Gangloff 2024-08-19 01:53:05 +02:00
parent 4a1f213b7a
commit 68a652bcc3
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629
8 changed files with 101 additions and 148 deletions

3
.env
View File

@ -46,7 +46,7 @@ LOCK_DSN=flock
###< symfony/lock ### ###< symfony/lock ###
###> symfony/mailer ### ###> symfony/mailer ###
# MAILER_DSN=null://null MAILER_DSN=null://null
###< symfony/mailer ### ###< symfony/mailer ###
###> symfony/messenger ### ###> symfony/messenger ###
@ -60,6 +60,7 @@ MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
MAILER_SENDER_NAME="Domain Watchdog" MAILER_SENDER_NAME="Domain Watchdog"
MAILER_SENDER_EMAIL=notifications@example.com MAILER_SENDER_EMAIL=notifications@example.com
REGISTRATION_ENABLED=true REGISTRATION_ENABLED=true
REGISTRATION_VERIFY_EMAIL=false
OAUTH_CLIENT_ID= OAUTH_CLIENT_ID=
OAUTH_CLIENT_SECRET= OAUTH_CLIENT_SECRET=
OAUTH_AUTHORIZATION_URL= OAUTH_AUTHORIZATION_URL=

View File

@ -1,10 +1,11 @@
<p align="center"><img src="https://github.com/user-attachments/assets/942ddfd0-2c76-4b00-bd9f-727cfddc0103" alt="Domain Watchdog" width="150" height="150" /></p> <p align="center"><img src="https://github.com/user-attachments/assets/942ddfd0-2c76-4b00-bd9f-727cfddc0103" alt="Domain Watchdog" width="150" height="150" /></p>
<h1 align="center"><b>Domain Watchdog</b></h1> <h1 align="center"><b>Domain Watchdog</b></h1>
<p align="center">Your companion in the quest for domain names</br><a href="https://domainwatchdog.eu">domainwatchdog.eu »</a></p> <p align="center">Your companion in the quest for domain names<br/><a href="https://domainwatchdog.eu">domainwatchdog.eu »</a></p>
<br/> <br/>
Domain Watchdog is a standalone application that utilizes RDAP to gather publicly accessible information about domain Domain Watchdog is a standalone application that utilizes RDAP to gather publicly accessible information about domain
names, track their history, and automatically purchase them. For more information please check [the wiki](https://github.com/maelgangloff/domain-watchdog/wiki) ! names, track their history, and automatically purchase them. For more information please
check [the wiki](https://github.com/maelgangloff/domain-watchdog/wiki) !
## Why use it? ## Why use it?
@ -25,17 +26,20 @@ detailed history of events (ownership changes, renewals, etc.) is not feasible w
### Docker Deployment ### Docker Deployment
1. Clone the repository 1. Clone the repository
2. Build the Docker image locally 2. Modify environment variables (.env) and add static files to customize your instance (see [INSTALL.md](/INSTALL.md))
3. Pull the latest version of the Domain Watchdog image from Docker Hub.
```shell ```shell
docker compose -f compose.yaml -f compose.prod.yaml build --pull --no-cache docker compose pull
``` ```
3. Modify environment variables and add static files to customize your instance 4. Start the project in production environment. If you want, you can also build the Docker image to use yourself.
4. Start the project in production environment
```shell ```shell
docker compose -f compose.yaml -f compose.prod.yaml up docker compose up
``` ```
## How it works? By default, the container listens on http://localhost:8080, but you can configure this in environment variables.
See the [Docker Compose file](./docker-compose.yml).
## Features
### RDAP search ### RDAP search
@ -46,9 +50,9 @@ ICANN launched a global vote in 2023 to propose replacing the WHOIS protocol wit
registrars will no longer be required to support WHOIS from 2025 (*WHOIS Sunset Date*).[^2] registrars will no longer be required to support WHOIS from 2025 (*WHOIS Sunset Date*).[^2]
Domain Watchdog uses the RDAP protocol, which will soon be the new standard for retrieving information concerning domain Domain Watchdog uses the RDAP protocol, which will soon be the new standard for retrieving information concerning domain
names. The data is organized in a SQL database to minimize space by ensuring an entity is not repeated. names.
### Connector Provider ### Auto-purchase domain
A connector is a way to order a domain name. It is important to mention that this project does not act as a payment A connector is a way to order a domain name. It is important to mention that this project does not act as a payment
intermediary. intermediary.
@ -63,24 +67,19 @@ The table below lists the supported API connector providers:
| GANDI | https://api.gandi.net/docs/domains/ | **Yes** | | GANDI | https://api.gandi.net/docs/domains/ | **Yes** |
| NAMECHEAP | https://www.namecheap.com/support/api/methods/domains/create/ | | | NAMECHEAP | https://www.namecheap.com/support/api/methods/domains/create/ | |
### Watchlist If a domain has expired and a connector is linked to the Watchlist, then Domain Watchdog will try to order it via the
connector provider's API.
Note: If the same domain name is present on several Watchlists, it is not possible to predict in advance which user will
win the domain name. The choice is left to chance.
### Monitoring
A watchlist is a list of domain names, triggers and possibly an API connector. A watchlist is a list of domain names, triggers and possibly an API connector.
They allow you to follow the life of the listed domain names and send you a notification when a change has been They allow you to follow the life of the listed domain names and send you a notification when a change has been
detected. detected.
A notification to the user is sent when a new event occurs on one of the domain names in the Watchlist. This can be an
If a domain has expired and a connector is linked to the Watchlist, then Domain Watchdog will try to order it via the email or a chat via Webhook. An iCalendar export of events is possible.
connector provider's API.
Note: If the same domain name is present on several Watchlists, on the same principle as the raise condition, it is not
possible to predict in advance which user will win the domain name. The choice is left to chance.
## Useful documentation
> [!NOTE]
> - [RFC 7482 : Registration Data Access Protocol (RDAP) Query Format](https://datatracker.ietf.org/doc/html/rfc7482)
> - [RFC 7483 : JSON Responses for the Registration Data Access Protocol (RDAP)](https://datatracker.ietf.org/doc/html/rfc7483)
> - [RFC 7484 : Finding the Authoritative Registration Data (RDAP) Service](https://datatracker.ietf.org/doc/html/rfc7484)
## Disclaimer ## Disclaimer
@ -92,6 +91,13 @@ possible to predict in advance which user will win the domain name. The choice i
> * The project installers are responsible for the use of their own instance. > * The project installers are responsible for the use of their own instance.
> * In no event the owner of this project will not be held responsible for other instances over which he has no control. > * In no event the owner of this project will not be held responsible for other instances over which he has no control.
## Useful documentation
> [!NOTE]
> - [RFC 7482 : Registration Data Access Protocol (RDAP) Query Format](https://datatracker.ietf.org/doc/html/rfc7482)
> - [RFC 7483 : JSON Responses for the Registration Data Access Protocol (RDAP)](https://datatracker.ietf.org/doc/html/rfc7483)
> - [RFC 7484 : Finding the Authoritative Registration Data (RDAP) Service](https://datatracker.ietf.org/doc/html/rfc7484)
## Licensing ## Licensing
This source code of this project is licensed under *GNU Affero General Public License v3.0 or later*. This source code of this project is licensed under *GNU Affero General Public License v3.0 or later*.

View File

@ -1,37 +0,0 @@
# Development environment override
services:
php:
build:
context: .
target: frankenphp_dev
volumes:
- ./:/app
- ./frankenphp/Caddyfile:/etc/caddy/Caddyfile:ro
- ./frankenphp/conf.d/20-app.dev.ini:/usr/local/etc/php/app.conf.d/20-app.dev.ini:ro
# If you develop on Mac or Windows you can remove the vendor/ directory
# from the bind-mount for better performance by enabling the next line:
#- /app/vendor
environment:
# See https://xdebug.org/docs/all_settings#mode
XDEBUG_MODE: "${XDEBUG_MODE:-off}"
extra_hosts:
# Ensure that host.docker.internal is correctly defined on Linux
- host.docker.internal:host-gateway
tty: true
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
mailer:
image: axllent/mailpit
ports:
- "1025"
- "8025"
environment:
MP_SMTP_AUTH_ACCEPT_ANY: 1
MP_SMTP_AUTH_ALLOW_INSECURE: 1
###< symfony/mailer ###

View File

@ -1,18 +0,0 @@
# Production environment override
services:
php:
build:
context: .
target: frankenphp_prod
environment:
APP_SECRET: ${APP_SECRET}
php-worker:
build:
context: .
target: frankenphp_prod
restart: always
command: php /app/bin/console messenger:consume --all --time-limit=3600 -vvv
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}

View File

@ -1,53 +0,0 @@
services:
php:
image: ${IMAGES_PREFIX:-}app-php
restart: unless-stopped
environment:
SERVER_NAME: ${SERVER_NAME:-localhost}, php:80
# Run "composer require symfony/orm-pack" to install and configure Doctrine ORM
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
# The two next lines can be removed after initial installation
SYMFONY_VERSION: ${SYMFONY_VERSION:-}
STABILITY: ${STABILITY:-stable}
volumes:
- caddy_data:/data
- caddy_config:/config
ports:
# HTTP
- target: 80
published: ${HTTP_PORT:-80}
protocol: tcp
# HTTPS
- target: 443
published: ${HTTPS_PORT:-443}
protocol: tcp
# HTTP/3
- target: 443
published: ${HTTP3_PORT:-443}
protocol: udp
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-16}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
healthcheck:
test: ["CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}"]
timeout: 5s
retries: 5
start_period: 60s
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
volumes:
caddy_data:
caddy_config:
###> doctrine/doctrine-bundle ###
database_data:
###< doctrine/doctrine-bundle ###

View File

@ -8,6 +8,7 @@ parameters:
mailer_sender_name: '%env(string:MAILER_SENDER_NAME)%' mailer_sender_name: '%env(string:MAILER_SENDER_NAME)%'
oauth_enabled: '%env(OAUTH_CLIENT_ID)%' oauth_enabled: '%env(OAUTH_CLIENT_ID)%'
registration_enabled: '%env(bool:REGISTRATION_ENABLED)%' registration_enabled: '%env(bool:REGISTRATION_ENABLED)%'
registration_verify_email: '%env(bool:REGISTRATION_VERIFY_EMAIL)%'
limited_features: '%env(bool:LIMITED_FEATURES)%' limited_features: '%env(bool:LIMITED_FEATURES)%'
limit_max_watchlist: '%env(int:LIMIT_MAX_WATCHLIST)%' limit_max_watchlist: '%env(int:LIMIT_MAX_WATCHLIST)%'

49
docker-compose.yml Normal file
View File

@ -0,0 +1,49 @@
# Please see https://github.com/maelgangloff/domain-watchdog
services:
domainwatchdog:
image: maelgangloff/domain-watchdog:latest
restart: unless-stopped
environment:
SERVER_NAME: http://${SERVER_NAME:-localhost}
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@${POSTGRES_HOST:-database}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
APP_SECRET: ${APP_SECRET:-ChangeMe}
REGISTRATION_ENABLED: ${REGISTRATION_ENABLED:-true}
REGISTRATION_VERIFY_EMAIL: ${REGISTRATION_ENABLED:-false}
LIMITED_FEATURES: ${LIMITED_FEATURES:-false}
LIMIT_MAX_WATCHLIST: ${LIMIT_MAX_WATCHLIST:-0}
LIMIT_MAX_WATCHLIST_DOMAINS: ${LIMIT_MAX_WATCHLIST_DOMAINS:-0}
MAILER_DSN: ${MAILER_DSN:-null://null}
volumes:
- caddy_data:/data
- caddy_config:/config
- ./public/content:/app/public/content
ports:
- 127.0.0.1:8080:80
php-worker:
image: maelgangloff/domain-watchdog:latest
restart: always
command: php /app/bin/console messenger:consume --all --time-limit=3600 -vvv
environment:
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@${POSTGRES_HOST:-database}:${POSTGRES_PORT:-5432}/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
APP_SECRET: ${APP_SECRET:-ChangeMe}
MAILER_DSN: ${MAILER_DSN:-null://null}
database:
image: postgres:${POSTGRES_VERSION:-16}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
healthcheck:
test: [ "CMD", "pg_isready", "-d", "${POSTGRES_DB:-app}", "-U", "${POSTGRES_USER:-app}" ]
timeout: 5s
retries: 5
start_period: 60s
volumes:
- database_data:/var/lib/postgresql/data:rw
volumes:
caddy_data:
caddy_config:
database_data:

View File

@ -75,6 +75,25 @@ class RegistrationController extends AbstractController
) )
); );
if (false === (bool) $this->getParameter('registration_verify_email')) {
$user->setVerified(true);
} else {
$email = $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
(new TemplatedEmail())
->from(new Address($this->mailerSenderEmail, $this->mailerSenderName))
->to($user->getEmail())
->locale('en')
->subject('Please Confirm your Email')
->htmlTemplate('emails/success/confirmation_email.html.twig')
);
$signedUrl = (string) $email->getContext()['signedUrl'];
$this->logger->notice('The validation link for user {username} is {signedUrl}', [
'username' => $user->getUserIdentifier(),
'signedUrl' => $signedUrl,
]);
}
$this->em->persist($user); $this->em->persist($user);
$this->em->flush(); $this->em->flush();
@ -82,21 +101,6 @@ class RegistrationController extends AbstractController
'username' => $user->getUserIdentifier(), 'username' => $user->getUserIdentifier(),
]); ]);
$email = $this->emailVerifier->sendEmailConfirmation('app_verify_email', $user,
(new TemplatedEmail())
->from(new Address($this->mailerSenderEmail, $this->mailerSenderName))
->to($user->getEmail())
->locale('en')
->subject('Please Confirm your Email')
->htmlTemplate('emails/success/confirmation_email.html.twig')
);
$signedUrl = (string) $email->getContext()['signedUrl'];
$this->logger->notice('The validation link for user {username} is {signedUrl}', [
'username' => $user->getUserIdentifier(),
'signedUrl' => $signedUrl,
]);
return new Response(null, 201); return new Response(null, 201);
} }