Skip to content

Commit

Permalink
Support SMTP in cloud server
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Oct 19, 2021
1 parent 208a506 commit d011cf6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docker/cloud/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get update && \
add-apt-repository -y ppa:opencpu/opencpu-2.2 && \
apt-get install -y opencpu-server rstudio-server
apt-get install -y opencpu-server rstudio-server postfix libsasl2-modules

RUN \
ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
Expand All @@ -16,4 +16,6 @@ RUN \
# Workaround for rstudio apparmor bug
RUN echo "server-app-armor-enabled=0" >> /etc/rstudio/rserver.conf

CMD service cron start && /usr/lib/rstudio-server/bin/rserver && apachectl -DFOREGROUND
COPY startup /startup

ENTRYPOINT ["/startup"]
21 changes: 21 additions & 0 deletions docker/cloud/startup
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
set -e

# Setup postfix if not done yet
if [ -f "/etc/postfix/sasl_passwd" ] && [ ! -f "/etc/postfix/sasl_passwd.db" ]; then
echo "Configuring postfix..."
postmap /etc/postfix/sasl_passwd
chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
echo "relayhost = smtp.mailgun.org" >> /etc/postfix/main.cf
echo "smtp_sasl_auth_enable = yes" >> /etc/postfix/main.cf
echo "smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd" >> /etc/postfix/main.cf
echo "smtp_sasl_security_options = noanonymous" >> /etc/postfix/main.cf
fi

# Start background services
service postfix start
service cron start
/usr/lib/rstudio-server/bin/rserver

# Start OpenCPU in foreground (blocking)
apachectl -DFOREGROUND

0 comments on commit d011cf6

Please sign in to comment.