Skip to content

Commit d373165

Browse files
author
Dimitris Kafetzis
committed
[WFLY-18768] OpenShift support for the mail quickstart
1 parent 65655aa commit d373165

File tree

16 files changed

+575
-182
lines changed

16 files changed

+575
-182
lines changed

.github/workflows/quickstart_mail_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ jobs:
1313
with:
1414
QUICKSTART_PATH: mail
1515
TEST_PROVISIONED_SERVER: true
16-
TEST_OPENSHIFT: false
16+
TEST_OPENSHIFT: true
1717
MATRIX_OS: '"ubuntu-latest"'
Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
#!/bin/sh
22

3-
# Start apache James with the required configuration
4-
docker run -d --rm --name "apache-james" \
5-
-p 1465:465 \
6-
-p 1993:993 \
7-
-p 1025:25 \
8-
-p 1110:110 \
9-
-p 1587:587 \
10-
-p 1143:143 \
11-
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/imapserver.xml:/root/conf/imapserver.xml \
12-
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/pop3server.xml:/root/conf/pop3server.xml \
13-
-v ${GITHUB_WORKSPACE}/quickstarts/mail/mail-server-conf/smtpserver.xml:/root/conf/smtpserver.xml \
14-
apache/james:demo-3.8.0
3+
# Start greenmail with the required configuration
4+
docker run -d --rm --name "greenmail" \
5+
-p 1465:3465 \
6+
-p 1993:3993 \
7+
-p 1025:3025 \
8+
-p 1110:3110 \
9+
-p 8081:8080 \
10+
-p 1143:3143 \
11+
greenmail/standalone:2.0.1

mail/README-source.adoc

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ include::../shared-doc/attributes.adoc[]
44
:author: Joel Tosi
55
:level: Beginner
66
:technologies: JavaMail, CDI, JSF
7+
:portedToGlow: true
78

89
[abstract]
910
The `mail` quickstart demonstrates how to send and receive emails using CDI and JSF and with custom Mail provider configured in {productName}.
@@ -40,34 +41,28 @@ To run the Mail Quickstart, you need a Mail Server configured with the following
4041

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

43-
- user01@james.local
44-
- user02@james.local
44+
- user01@mail.local
45+
- user02@mail.local
4546

46-
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.
47+
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 a Greenmail mail server with all the required configuration.
48+
You will need to have installed a Container Engine capable of working with Docker compose files and Linux images.
49+
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.
4750

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

50-
```
53+
[source, bash]
54+
----
5155
$ podman compose up --wait
5256
>>>> Executing external compose provider "/usr/local/bin/docker-compose". Please refer to the documentation for details. <<<<
57+
----
5358

54-
[+] Running 1/1
55-
✔ Container apache-james Healthy
56-
```
57-
58-
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].
59-
All accounts use the same password: `1234`
60-
61-
Once you have finished with the Mail Quickstart, you can shutdown and remove the Apache James Mail server with the following command:
59+
Once you have finished with the Mail Quickstart, you can shutdown and remove the Greenmail server with the following command:
6260

63-
```
61+
[source, bash]
62+
----
6463
$ podman compose down --volumes
6564
>>>> Executing external compose provider "/usr/local/bin/docker-compose". Please refer to the documentation for details. <<<<
66-
67-
[+] Running 2/1
68-
✔ Container apache-james Removed
69-
✔ Network mail_default Removed
70-
```
65+
----
7166

7267
// Back Up the {productName} Standalone Server Configuration
7368
include::../shared-doc/back-up-server-standalone-configuration.adoc[leveloffset=+1]
@@ -115,7 +110,6 @@ The following `outbound-socket-binding` groups are added to the `standard-socket
115110
----
116111
<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
117112
...
118-
</outbound-socket-binding>
119113
<outbound-socket-binding name="my-imap-binding">
120114
<remote-destination host="localhost" port="1143"/>
121115
</outbound-socket-binding>
@@ -137,9 +131,9 @@ The `MyOtherMail` mail session is added to the `mail` subsystem and configured t
137131
<smtp-server outbound-socket-binding-ref="mail-smtp"/>
138132
</mail-session>
139133
<mail-session name="MyOtherMail" debug="true" jndi-name="java:jboss/mail/MyOtherMail">
140-
<smtp-server outbound-socket-binding-ref="my-smtp-binding" username="user01@james.local" password="1234"/>
134+
<smtp-server outbound-socket-binding-ref="my-smtp-binding" username="user01@mail.local" password="1234"/>
141135
<pop3-server outbound-socket-binding-ref="my-pop3-binding"/>
142-
<imap-server outbound-socket-binding-ref="my-imap-binding" username="user02@james.local" password="1234"/>
136+
<imap-server outbound-socket-binding-ref="my-imap-binding" username="user02@mail.local" password="1234"/>
143137
</mail-session>
144138
</subsystem>
145139
----
@@ -152,9 +146,6 @@ include::../shared-doc/build-and-deploy-the-quickstart.adoc[leveloffset=+1]
152146
The application will be running at the following URL: http://localhost:8080/{artifactId}/[http://localhost:8080/{artifactId}/^].
153147

154148
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].
155-
156-
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].
157-
158149
// Server Distribution Testing
159150
include::../shared-doc/run-integration-tests-with-server-distribution.adoc[leveloffset=+1]
160151
// Undeploy the Quickstart
@@ -177,5 +168,5 @@ include::../shared-doc/restore-standalone-server-configuration-manual.adoc[level
177168
// Build and run sections for other environments/builds
178169
include::../shared-doc/build-and-run-the-quickstart-with-provisioned-server.adoc[leveloffset=+1]
179170

180-
// Quickstart not compatible with OpenShift
181-
include::../shared-doc/openshift-incompatibility.adoc[leveloffset=+1]
171+
// OpenShift
172+
include::../shared-doc/build-and-run-the-quickstart-with-openshift.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)