Skip to content

Commit

Permalink
[WFLY-18768] OpenShift support for the mail quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitris Kafetzis committed Jun 27, 2024
1 parent 01313ed commit dcd43d1
Show file tree
Hide file tree
Showing 15 changed files with 483 additions and 141 deletions.
19 changes: 8 additions & 11 deletions .github/workflows/quickstart_mail_ci_before.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#!/bin/sh

# Start apache James with the required configuration
docker run -d --rm --name "apache-james" \
-p 1465:465 \
-p 1993:993 \
-p 1025:25 \
-p 1110:110 \
-p 1587:587 \
-p 1143:143 \
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/imapserver.xml:/root/conf/imapserver.xml \
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/pop3server.xml:/root/conf/pop3server.xml \
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/smtpserver.xml:/root/conf/smtpserver.xml \
apache/james:demo-3.8.0
docker run -d --rm --name "greenmail" \
-p 1465:3465 \
-p 1993:3993 \
-p 1025:3025 \
-p 1110:3110 \
-p 8081:8080 \
-p 1143:3143 \
greenmail/standalone:2.0.1
24 changes: 9 additions & 15 deletions mail/README-source.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ To run the Mail Quickstart, you need a Mail Server configured with the following

In addition, the Mail Subsystem configuration and the test cases expect you have the following Mail accounts configured on your Mail Server:

- user01@james.local
- user02@james.local
- user01@mail.local
- user02@mail.local

You can use any Mail Server you consider, although to facilitate this task, you will find under the Mail Quickstart root directory a docker compose file prepared to launch an Apache James Mail server with all the required configuration. You will need to have installed a Container Engine capable of work with Docker compose files and Linux images. The following command assumes you have https://podman.io/[Podman] and https://docs.podman.io/en/latest/markdown/podman-compose.1.html[Podman Compose] installed in your local environment.
You can use any Mail Server you consider, although to facilitate this task, you will find under the Mail Quickstart root directory a docker compose file prepared to launch an Greenmail mail server with all the required configuration. You will need to have installed a Container Engine capable of work with Docker compose files and Linux images. The following command assumes you have https://podman.io/[Podman] and https://docs.podman.io/en/latest/markdown/podman-compose.1.html[Podman Compose] installed in your local environment.

To launch the Apache James Mail server, open the terminal and navigate to the Mail Quickstart root directory and execute the following:
To launch the Greenmail server, open the terminal and navigate to the Mail Quickstart root directory and execute the following:

```
$ podman compose up --wait
Expand All @@ -56,10 +56,7 @@ $ podman compose up --wait
✔ Container apache-james Healthy
```

NOTE: The Apache James server is configured without allowing the relay of the emails to external addresses that are not configured in the server. When you are sending / receiving emails with this server, you have to use the accounts shipped with the apache James demo image. These are the accounts available out of the box: [email protected], [email protected] and [email protected].
All accounts use the same password: `1234`

Once you have finished with the Mail Quickstart, you can shutdown and remove the Apache James Mail server with the following command:
Once you have finished with the Mail Quickstart, you can shutdown and remove the Greenmail server with the following command:

```
$ podman compose down --volumes
Expand Down Expand Up @@ -138,9 +135,9 @@ The `MyOtherMail` mail session is added to the `mail` subsystem and configured t
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
</mail-session>
<mail-session name="MyOtherMail" debug="true" jndi-name="java:jboss/mail/MyOtherMail">
<smtp-server outbound-socket-binding-ref="my-smtp-binding" username="user01@james.local" password="1234"/>
<smtp-server outbound-socket-binding-ref="my-smtp-binding" username="user01@mail.local" password="1234"/>
<pop3-server outbound-socket-binding-ref="my-pop3-binding"/>
<imap-server outbound-socket-binding-ref="my-imap-binding" username="user02@james.local" password="1234"/>
<imap-server outbound-socket-binding-ref="my-imap-binding" username="user02@mail.local" password="1234"/>
</mail-session>
</subsystem>
----
Expand All @@ -153,9 +150,6 @@ include::../shared-doc/build-and-deploy-the-quickstart.adoc[leveloffset=+1]
The application will be running at the following URL: http://localhost:8080/{artifactId}/[http://localhost:8080/{artifactId}/^].

NOTE: If you see `Error processing request` in the browser when you access the application and attempt to send email, followed by `jakarta.servlet.ServletException: MailConnectException: Couldn&#39;t connect to host, port: localhost, 1025; timeout -1; nested exception is: java.net.ConnectException: Connection refused`, make sure you followed the instructions above to xref:configure_an_smtp_server_on_your_local_machine[Configure an SMTP Server on Your Local Machine].

NOTE: If you are using the Mail server shipped with this Quickstart and see `Error sending the Email. Invalid Addresses` in the browser when you attempt to send email, make sure you are sending your email to an existing account configured in the Mail Server since by default Apache James demo image is shipped with relay disabled. By default, Apache James demo image has the following accounts configured: [email protected], [email protected] and [email protected].

// Server Distribution Testing
include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+2]

Expand Down Expand Up @@ -198,7 +192,7 @@ endif::[]
//*************************************************
ifdef::ProductRelease[]
// Quickstart not compatible with OpenShift
include::../shared-doc/openshift-incompatibility.adoc[leveloffset=+1]
// OpenShift
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]
endif::[]
Loading

0 comments on commit dcd43d1

Please sign in to comment.