Skip to content
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

Dockerize services #26

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Dockerize services #26

wants to merge 8 commits into from

Conversation

kabili207
Copy link
Contributor

@kabili207 kabili207 commented Oct 30, 2024

This is built off of PR #22, with a variety of changes and additions. After waiting for feedback from ylambda regarding pulling my changes into their PR for several months, I decided to open a PR of my own in hopes our changes will be merged.

All services required to run a server, outside of the relay, are covered

  • Switch to Alpine based images
    • They're usually smaller and rarely any harder to work with
  • Split dependency fetching and building to separate images
    • While probably not very important for REON, it can help reduce the number of layers and result in smaller images
    • Also has the benefit of allowing more things to be parallelized if using docker buildx
  • Allow specifying location of config.json in node programs via a new -c argument
  • Partial support for setting config options via environment variables
    • Only works with the mail and mysql containers right now, but it's a start
    • An example.env was added with the mysql options
    • See mail/entrypoint.sh for a full set of options
  • Adds image to handle processing of cron jobs
  • Add DNS service with dnsmasq
    • The config is generated on the fly and acts as a non-recursive server by default
    • The host's IP address must be supplied via the EXTERNAL_IP environment variable (in .env), otherwise it will respond with NXDOMAIN

ylambda and others added 5 commits June 7, 2024 08:29
Already using mysql2 in smtp.js and this supports newer auth
Without this, I was seeing an error:

(POP3) Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client
- Splits dependency fetching and building to separate images
- Allow specifying location of config.json in node apps
- Adds image to handle processing of cron jobs
- Partial support of setting config options via env variables
Docker commands really shouldn't be inside a Makefile
@milkcanworld
Copy link

Just in case: for me, add_user.php doesn't seem to work with a fresh deployment:

Warning: Trying to access array offset on null in /var/www/reon/web/classes/DBUtil.php on line 11

Warning: Trying to access array offset on null in /var/www/reon/web/classes/DBUtil.php on line 11

Warning: Trying to access array offset on null in /var/www/reon/web/classes/DBUtil.php on line 11

Warning: Trying to access array offset on null in /var/www/reon/web/classes/DBUtil.php on line 11

Fatal error: Uncaught mysqli_sql_exception: No such file or directory in /var/www/reon/web/classes/DBUtil.php:11
Stack trace:
#0 /var/www/reon/web/classes/DBUtil.php(11): mysqli->__construct(NULL, NULL, Object(SensitiveParameterValue), NULL)
#1 /var/www/reon/web/classes/DBUtil.php(16): DBUtil->__construct()
#2 /var/www/reon/web/scripts/add_user.php(6): DBUtil::getInstance()
#3 /var/www/reon/web/scripts/add_user.php(46): main()
#4 {main}
  thrown in /var/www/reon/web/classes/DBUtil.php on line 11

config.json:

{
        "hostname": "gameboy.datacenter.ne.jp";
        "email_domain": "gameboy.datacenter.ne.jp",
        "email_domain_dion": "cool.dion.ne.jp",
        "mysql_host": "db",
        "mysql_user": "reon",
        "mysql_password": "password",
        "mysql_database": "db",
        "amoj_regist": "h200"
}

(gameboy.datacenter.ne.jp is resolvable).

@kabili207
Copy link
Contributor Author

Are you using the full docker compose exec -w /var/www/reon/web/scripts web php add_user.php command or are you running add_user.php on it's own outside of the container?

@milkcanworld
Copy link

milkcanworld commented Nov 12, 2024

I'm running the full docker command. The only thing I can think of is that a previous run had a mistake in the config.json, but I removed all containers and did a full docker system prune --all after that before doing anything else, so I wouldn't think that's affecting anything.

@milkcanworld
Copy link

milkcanworld commented Nov 12, 2024

shes_sad.mp4

Here's a short screen capture.

EDIT: Well, that's embarrassing. In her infinite wisdom, yesterday me ended line 2 of config.json with a semicolon instead of a comma. That'd do it. Sheesh. Sorry about that.

Now though, I get an error about db not being resolvable. I know this isn't handling DNS yet, so is it assumed that you have that in your external DNS setup already or is that supposed to be working as is?

@kabili207
Copy link
Contributor Author

That screen cap helps a bit. I've updated the README to include a missing step that's likely the cause of your issues.

Now though, I get an error about db not being resolvable. I know this isn't handling DNS yet, so is it assumed that you have that in your external DNS setup already or is that supposed to be working as is?

The db name is internal to docker and should automatically be handled by compose. The DNS service is used to direct the adapter to the REON services. The dummy-servers project has python DNS server you can modify for that aspect.

I would highly recommend joining the REON Discord server if you haven't already. The project isn't in a public-ready state yet and there are a few things you'll want to do after getting the containers working properly in order to actually use it.

@kabili207
Copy link
Contributor Author

I've added DNS to the services included int he docker setup. I opted to use dnsmasq as it's widely used, fairly lightweight compared to other popular DNS servers, and the config is simple enough to generate on-the-fly without looking like a mess. It has been set up to run as a non-recursive resolver, so nothing outside of the REON services should resolve

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants