Skip to content

Commit e245229

Browse files
Rub21geohacker
authored andcommitted
Config Mail sender - web container
1 parent e4af2ab commit e245229

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

envs/.env.web.example

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ MAILER_USERNAME=...
1212
MAILER_PASSWORD=...
1313
1414

15+
# Mailer settings for gmail, you need to enable "IMAP Access" and "Allow less secure apps"
16+
MAILER_ADDRESS=smtp.gmail.com
17+
MAILER_DOMAIN=localhost
18+
19+
MAILER_PASSWORD=abc
20+
21+
22+
1523
# Nominatim settings
1624
NOMINATIM_URL=nominatim-api
1725

images/web/Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN echo "gem 'image_optim_pack', :git => 'git://github.com/toy/image_optim_pack
4545
# Install Ruby packages
4646
RUN gem install bundler && bundle install
4747

48-
# Configure database.yml, application.yml and secrets.yml
48+
# Configure database.yml and secrets.yml
4949
RUN cp $workdir/config/example.database.yml $workdir/config/database.yml
5050
RUN touch $workdir/config/settings.local.yml
5151
RUN cp $workdir/config/example.storage.yml $workdir/config/storage.yml
@@ -90,7 +90,11 @@ RUN a2ensite cgimap
9090
RUN apache2ctl configtest
9191

9292
# Set Permissions for www-data
93-
RUN chown -R www-data: /var/www
93+
RUN chown -R www-data: $workdir
94+
95+
# Add settings
96+
ADD config/settings.yml $workdir/config/settings.yml
9497

9598
COPY start.sh $workdir/
99+
96100
CMD $workdir/start.sh

images/web/start.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ workdir="/var/www"
33

44
export RAILS_ENV=production
55
# Because we can not set up many env variable sin build process, we are going to process here!
6-
# Setting up the production database
6+
7+
#### SETTING UP THE PRODUCTION DATABASE
78
echo " # Production DB
89
production:
910
adapter: postgresql
@@ -13,10 +14,19 @@ production:
1314
password: ${POSTGRES_PASSWORD}
1415
encoding: utf8" >$workdir/config/database.yml
1516

16-
# Setting up the SERVER_URL and SERVER_PROTOCOL
17+
#### SETTING UP SERVER_URL AND SERVER_PROTOCOL
1718
sed -i -e 's/server_url: "openstreetmap.example.com"/server_url: "'$SERVER_URL'"/g' $workdir/config/settings.yml
1819
sed -i -e 's/server_protocol: "http"/server_protocol: "'$SERVER_PROTOCOL'"/g' $workdir/config/settings.yml
1920

21+
#### SETTING UP MAIL SENDER
22+
sed -i -e 's/smtp_address: "localhost"/smtp_address: "'$MAILER_ADDRESS'"/g' $workdir/config/settings.yml
23+
sed -i -e 's/smtp_domain: "localhost"/smtp_domain: "'$MAILER_DOMAIN'"/g' $workdir/config/settings.yml
24+
sed -i -e 's/smtp_enable_starttls_auto: false/smtp_enable_starttls_auto: true/g' $workdir/config/settings.yml
25+
sed -i -e 's/smtp_authentication: null/smtp_authentication: "login"/g' $workdir/config/settings.yml
26+
sed -i -e 's/smtp_user_name: null/smtp_user_name: "'$MAILER_USERNAME'"/g' $workdir/config/settings.yml
27+
sed -i -e 's/smtp_password: null/smtp_password: "'$MAILER_PASSWORD'"/g' $workdir/config/settings.yml
28+
sed -i -e 's/email_from: "OpenStreetMap <[email protected]>"/email_from: "'$MAILER_FROM'"/g' $workdir/config/settings.yml
29+
2030
# Check if DB is already up
2131
flag=true
2232
while "$flag" = true; do
@@ -35,6 +45,6 @@ while "$flag" = true; do
3545
# Start the delayed jobs queue worker
3646
# bundle exec rake jobs:work
3747
# Start the app
38-
# bundle exec rails server
48+
bundle exec rake jobs:work &
3949
apachectl -k start -DFOREGROUND
4050
done

0 commit comments

Comments
 (0)