-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Install #33
Comments
Hi @emhl, I just added Docker support following this template. Can you tell me if it works for you? Thanks! |
since no image has been published on docker hub with the name app-php the image: line needed to be removed. btw. if the containers are all in the same docker network (they are by default if defined in the same compose file) the database and mail ports don't need to be exposed publicly anymore. and so caddy doesn't try to obtain a tls cert for localhost SERVER_NAME could be set to http://localhost instead of localhost (in order to fix a caddy error i needed to add the libnss3-tools package as well)
the build for the frontend seems to be missing from the dockerfile and the app wasn´t copied to the /app directory. i tried to modify the Dockerfile a bit in order to get it running, but could not get it into a working state |
Thanks for your feedback and testing @emhl The app-php image is built locally before being used. The database is not exposed publicly : Port 5432 is internal to the container group and is not exposed. Indeed, the frontend was not built. I just fixed that. From my first tests, it seems to work. Commands to launch the production environment:
docker compose -f compose.yaml -f compose.prod.yaml build --pull --no-cache
docker compose -f compose.yaml -f compose.prod.yaml up We are reaching the goal of dockerization! |
Thanks for your work. this is getting ready quite fast
if you don't specify the compose file it uses the compose.yaml and compose.override.yaml file as configuration, because of the content of the compose.override.yaml file the database port was exposed outside of the docker network for me
the frontend seems to work now, but the static text doesn't seem to load. and when trying to create an account with this setup, the backend application throws an error about the MAILER_DSN environment variable not being set. i guess the app is trying to send a verification email but the service isn't confugured. php-1 | "message":"Matched route \"user_register\".","context":{"route":"user_register","route_parameters":{"_route":"user_register","_api_resource_class":"App\\Entity\\User","_api_operation_name":"register","_controller":"App\\Controller\\RegistrationController::register"},"request_uri":"http://localhist:80/api/register","method":"POST"},"level":200,"level_name":"INFO","channel":"request","datetime":"2024-08-11T19:16:18.751651+00:00","extra":{}}
php-1 | {"message":"Checking for authenticator support.","context":{"firewall_name":"api","authenticators":1},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2024-08-11T19:16:18.751787+00:00","extra":{}}
php-1 | {"message":"Checking support on authenticator.","context":{"firewall_name":"api","authenticator":"Lexik\\Bundle\\JWTAuthenticationBundle\\Security\\Authenticator\\JWTAuthenticator"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2024-08-11T19:16:18.751792+00:00","extra":{}}
php-1 | {"message":"Authenticator does not support the request.","context":{"firewall_name":"api","authenticator":"Lexik\\Bundle\\JWTAuthenticationBundle\\Security\\Authenticator\\JWTAuthenticator"},"level":100,"level_name":"DEBUG","channel":"security","datetime":"2024-08-11T19:16:18.751800+00:00","extra":{}}
php-1 | {"message":"Uncaught PHP Exception InvalidArgumentException: \"The controller for URI \"/api/register\" is not callable: Environment variable not found: \"MAILER_DSN\".\" at ControllerResolver.php line 97","context":{"exception":{"class":"InvalidArgumentException","message":"The controller for URI \"/api/register\" is not callable: Environment variable not found: \"MAILER_DSN\".","code":0,"file":"/app/vendor/symfony/http-kernel/Controller/ControllerResolver.php:97","previous":{"class":"Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException","message":"Environment variable not found: \"MAILER_DSN\".","code":0,"file":"/app/vendor/symfony/dependency-injection/EnvVarProcessor.php:221"}}},"level":500,"level_name":"CRITICAL","channel":"request","datetime":"2024-08-11T19:16:18.774164+00:00","extra":{}} i haven't found any documentation on how to create accounts through the cli or from environment variables yet, or if there are default credentials edit: the static text not loading seems to be because the markdown files and images in the public folder aren't present in this repository by default
|
I made the text files fully customizable. See here for the list. The text files are Markdown files. These include the homepage, the TOS and the privacy policy (different content for each instance). There are no default credentials. You have to create an account by making sure that the flag Indeed, the installation is not yet properly documented. I will be careful to document the installation well. Thank you for your time |
thank's for all the hints. btw the error about the mail address being unvalidated is currently silent in the frontend. and it would be nice if the email confirmation link would get printed to the log when setting up a new account, so one doesn't need to manually jump into the database or set up email delivery
it is awesome that they are customizable, but a bit confusing that they are empty by default. |
Good idea for the logs!
I'm not sure if proposing a template for legal files is a good idea, I'll think about it. For the homepage it could be done I guess. |
I just implemented the validation link logging : I will add documentation to explain the installation process via Docker. Thanks for your feedback, I think this issue can be closed. |
i noticed docker support in a recent release - thanks! are there any plans for prebuilt images for those looking to avoid the complexity of building their own? |
Hi @halphalp, Indeed, the project is now deployable with Docker. You probably need to adapt the compose.yaml file to use this remote image. Feel free to leave a message if you have any difficulties with the deployment ;) |
this doesn't seem to work - i'm trying to use existing installations of caddy and postgres along with this project. any thoughts?
|
Definitely, this containerization will not have been so easy ( maybe some kind of black magic 🪄 ) @halphalp : docker pull maelgangloff/domain-watchdog:latest Here is a part of my docker-compose.yaml file: ...
domainwatchdog:
image: maelgangloff/domain-watchdog:latest
restart: unless-stopped
environment:
SERVER_NAME: localhost
DATABASE_URL: postgresql://${POSTGRES_USER:-app}:${POSTGRES_PASSWORD:-!ChangeMe!}@database:5432/${POSTGRES_DB:-app}?serverVersion=${POSTGRES_VERSION:-15}&charset=${POSTGRES_CHARSET:-utf8}
SYMFONY_VERSION: ${SYMFONY_VERSION:-}
STABILITY: ${STABILITY:-stable}
APP_ENV: prod
APP_SECRET: mysecret
MAILER_DSN: null://null
MAILER_SENDER_NAME: "Domain Watchdog"
MAILER_SENDER_EMAIL: notifications@example.com
REGISTRATION_ENABLED: true
LIMITED_FEATURES: false
LIMIT_MAX_WATCHLIST: 0
LIMIT_MAX_WATCHLIST_DOMAINS: 0
volumes:
- caddy_data:/data
- caddy_config:/config
ports:
- target: 80
published: ${HTTP_PORT:-80}
protocol: tcp
... Be careful not to set SERVER_NAME: '*' Here is the documentation of the Caddyfile: https://caddyserver.com/docs/caddyfile I'll leave this issue open in the meantime. Thanks! |
i just realized the container is also deploying caddy. is there a way to deploy just domain-watchdog and proxy to it using an instance of caddy i use for other services? |
No, I don't think that's possible. You definitely need a web server for the Docker container to be accessible from the outside. You can't just deploy a php application, you need a web server (Caddy, Nginx, Apache, ...) I suggest you use a different port and use your Caddy server to proxy the requests. Did you successfully deploy this project? |
this is what i'm strugglign with. the domain-watchdog container seems to deploy correctly - i just can't find a suitable caddy directive to serve it with in my existing caddy installation. i've tried: reverse_proxy domain-watchdog:80 domain-watchdog is in my 'caddy' docker network, so i'm not sure where the disconnect is. |
@halphalp In your docker-compose file, did you name the service (you used both of these service names in this issue) Be sure to have the same hostname in both your Caddyfile and your docker-compose file, otherwise Docker won't understand which container you're referring to ;) I advise you not to use HTTPS inside your containers, this will avoid self-signed certificate issues and reduce latency a bit. |
good callout - i changed it between comments above, but have named it properly in my compose file and caddyfile but still no luck. here's my latest compose file:
|
@halphalp Don't forget to add Can you try setting |
so close! making those two changes now loads a blank white page instead of an error. |
@halphalp if caddy is defined in s different stack the hostname for the dw container is probably domain-watcher-domain-watcher-1 but you could set it to domain-watcher with the container_name option |
Setting SERVER_NAME=http://* leads to a blank page with a red ghost favicon for me as well. Caddy probably can't handle this configuration. I use traefik as my reverse proxy. In order to get it working I set SERVER_NAME=http://domain-watcher.my-domain.net so caddy doesn't try to get a certificate since the Webserver isn't publicly accessible anyways. And used Host( |
After setting up the docker container and proxying through nginx using the following compose:
I get the following errors and thus the website is constantly loading. GET http://domain/content/home.md -> Returns 404 -> No route found |
@skyracer2012 These errors are normal for an instance that has just been deployed. Regarding the first request mentioned, you need to add the following files: public/content/home.md
public/content/privacy.md
public/content/tos.md
public/content/faq.md
public/images/icons-512.png
public/images/banner.png
public/favicon.ico These files correspond to files that correspond to your own instance (legal documents in particular). Regarding the second request: The frontend is trying to find out if you are connected or not. This response is completely normal if you are not connected. I advise you to add the missing files by mounting a volume on The error you describe is not blocking the use of your DW instance locally. |
okay, definitely making progress. the page loads, but i can't do anything and get a bunch of /api and /#/login errors in the console when trying to create an account or log in. my current docker compose file:
my caddy file is simply:
and here are the console errors i'm seeing: |
@halphalp These errors are normal for an instance that has just been deployed. These are the same HTTP errors encountered by @skyracer2012. I refer you to my last message. I draw your attention to the fact that these errors are not blocking for personal use. You must retrieve the validation link from the logs to be able to validate the account. This link is usually sent by email if you have configured an SMTP server. Is your instance functional? |
So I have been able to set it up with the config I mentioned above. I just added the REGISTRATION_ENABLED parameter. After registering I did not see the confirmation url in the docker logs so I verified myself in the database. After Login I get a 200 response from the Also the comment you made above. It seems like the path is |
@skyracer2012 Yes, typo, it is Thanks for reporting this error. I think I found the problem, the JWT key pair is not generated on first launch. I am deploying a fix and publishing a release afterwards. Thanks for the feedback! |
Release v0.1.5 has just been published 🎉 docker pull maelgangloff/domain-watchdog:latest I hope this will fix the problem ;) EDIT: I just noticed that the list of RDAP servers to contact is empty when deploying with Docker. I'll see to make sure that this list is instantiated on the first launch (otherwise you would have to wait 24 hours...) |
Adding this to your docker compose should instantiate the list of RDAP servers on first startup and process Watchlists: ...
php-worker:
image: maelgangloff/domain-watchdog:latest
restart: always
command: php /app/bin/console messenger:consume --all --time-limit=3600 -vvv
environment:
DATABASE_URL: ${DATABASE_URL}
... |
i was experiencing the same issues as @skyracer2012 before v0.1.5 (could register, log in, but the JW token error prevented me from doing anything) and have now updated my compose file to include the new command and pull v0.1.6 and can no longer access the web interface (the container is marked as unhealthy). here are the last ~25 lines of the container logs:
thanks for all of the work and quick responses on this, by the way! anxious to start using this. |
It's hard to debug remotely and identify the problem you're having. I've created a Gist file with a working configuration. Here is the link https://gist.github.com/maelgangloff/ca1dfa18becefccb1ac1ff82c4a73ef8 (I tested it on two different machines) Be careful to delete browser cookies as JWT keys have changed. Looking forward to hearing from you with good news 🙌 |
do i need the new php-worker every time, or just run it once the very first time i deploy? |
The worker must be active continuously. It handles asynchronous tasks such as:
Have you successfully deployed this project? |
It works really nice! One Problem I did encounter is the php-worker due to using the |
Hi @skyracer2012 I updated the Docker Compose to disable the healthcheck. I think it's better to do that than to include the worker in the web app container. Hopefully this will fix this issue ;) |
since Ubuntu 22.04 ships php 8.1 i wasn't able to try out this application yet.
In order to make deployments easier and less dependant on the php version of the host system and run it in a containerized environment, it would be awesome if a docker image would be provided for this project
the work by the symfony-docker project could probably be used as a great starting point to create a docker image
https://github.com/dunglas/symfony-docker/blob/main/docs/existing-project.md
The text was updated successfully, but these errors were encountered: