Compare commits
5 Commits
mailcatche
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 15a9c22366 | |||
| 279ed39659 | |||
| 438c3a5ce1 | |||
| 55ac4b56de | |||
| a740773413 |
136
README.md
136
README.md
@@ -1,130 +1,14 @@
|
|||||||
# Mailcatcher Testserver
|
# ⚠️ MODULE IS OPTIONEEL ⚠️
|
||||||
|
|
||||||
## Mailhog installeren
|
Documentatie:
|
||||||
```
|
https://www.odoo.com/documentation/19.0/administration/neutralized_database.html
|
||||||
chmod +x install_mailhog_as_service.sh
|
|
||||||
./install_mailhog_as_service.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
## Workaround bij foutmelding in Ubuntu 22.04: "note: module requires Go 1.20"
|
## Neutralize Database
|
||||||
```
|
|
||||||
- Download gewenste versie van Go:
|
|
||||||
wget -c https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
|
|
||||||
|
|
||||||
- Ga naar de map waar het bestand staat en pak het uit:
|
|
||||||
sudo tar -C /usr/local/ -xzf go1.22.0.linux-amd64.tar.gz
|
|
||||||
|
|
||||||
- Set PATH Environment Variable
|
|
||||||
export PATH=$PATH:/usr/local/go/bin
|
|
||||||
|
|
||||||
- Voeg onderstaande code toe aan .profile om het definitief te maken:
|
|
||||||
# set PATH so it includes /usr/local/go/bin if it exists
|
|
||||||
if [ -d "/usr/local/go/bin" ] ; then
|
|
||||||
PATH="/usr/local/go/bin:$PATH"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- reload .profile (let op: mét punt!)
|
|
||||||
. ~/.profile
|
|
||||||
|
|
||||||
- Controleer welke versie van Go actief is:
|
|
||||||
go version
|
|
||||||
|
|
||||||
- Installeer nu Mailhog met het installatie script
|
|
||||||
```
|
|
||||||
|
|
||||||
## Na de installatie
|
|
||||||
```
|
|
||||||
systemctl enable mailhog
|
|
||||||
```
|
|
||||||
reboot server
|
|
||||||
|
|
||||||
|
|
||||||
Nginx configuratie (gebruik template: xxx.BEWAREN.mailcatcher.open2bizz.com.conf)
|
|
||||||
|
|
||||||
```
|
|
||||||
server {
|
|
||||||
listen 8025;
|
|
||||||
server_name 434-mailcatcher.staging.open2bizz.com;
|
|
||||||
|
|
||||||
# log
|
|
||||||
access_log /var/log/nginx/434.access.log;
|
|
||||||
error_log /var/log/nginx/434.error.log;
|
|
||||||
|
|
||||||
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
|
|
||||||
gzip on;
|
|
||||||
|
|
||||||
|
|
||||||
location / {
|
|
||||||
#kantoor Open2bizz 83.84.200.111
|
|
||||||
allow 83.84.200.111;
|
|
||||||
allow 83.82.145.237;
|
|
||||||
allow 45.132.40.125;
|
|
||||||
allow 86.93.238.87;
|
|
||||||
allow 80.114.214.241;
|
|
||||||
allow 94.157.36.155;
|
|
||||||
allow 145.131.221.238;
|
|
||||||
deny all;
|
|
||||||
|
|
||||||
auth_basic "Administrator Area";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd;
|
|
||||||
|
|
||||||
proxy_redirect off;
|
|
||||||
proxy_pass http://192.168.78.134:8025;
|
|
||||||
}
|
|
||||||
|
|
||||||
#error pages
|
|
||||||
error_page 500 501 502 503 504 https://www.open2bizz.tech/503;
|
|
||||||
|
|
||||||
listen 443 ssl; # managed by Certbot
|
|
||||||
ssl_certificate /etc/letsencrypt/live/434-mailcatcher.staging.open2bizz.com/fullchain.pem; # managed by Certbot
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/434-mailcatcher.staging.open2bizz.com/privkey.pem; # managed by Certbot
|
|
||||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
In de nginx config file een wachtwoord opnemen:
|
|
||||||
```
|
|
||||||
|
|
||||||
========================================================
|
|
||||||
Voorbeeld:
|
|
||||||
In de nginx config file voor omgeving 499 een wachtwoord instellen:
|
|
||||||
========================================================
|
|
||||||
|
|
||||||
auth_basic "Administrator Area";
|
|
||||||
auth_basic_user_file /etc/nginx/.htpasswd-499;
|
|
||||||
========================================================
|
|
||||||
|
|
||||||
Voor iedere omgeving is op de 401 een aparte .htpasswd aangemaakt in de map /etc/nginx/
|
|
||||||
Voor alle test-omgevingen in de reeks 402 en 499 is een bestand aangemaakt.
|
|
||||||
Om een nieuw htpasswd te maken (bijvoorbeeld in de 500-reeks) kan het beste een bestaande file gekopieerd worden:
|
|
||||||
cp /etc/nginx/.htpasswd-402 /etc/nginx/.htpasswd-499
|
|
||||||
|
|
||||||
Om al de (verborgen) .htpasswd bestanden opvragen:
|
|
||||||
ls -rtla /etc/nginx | grep .htpasswd
|
|
||||||
|
|
||||||
Een .htpasswd kan bekeken worden met nano, maar je ziet dan alleen de user én het encrypte wachtwoord:
|
|
||||||
nano /etc/nginx/.htpasswd-499
|
|
||||||
|
|
||||||
Om een nieuw wachtwoord in te stellen voor de user 'mail' voor omgeving 499:
|
|
||||||
htpasswd /etc/nginx/.htpasswd-499 mail
|
|
||||||
|
|
||||||
=================================================
|
|
||||||
Om de wijzigingen toe te passen moet nginx herstart worden:
|
|
||||||
service nginx restart
|
|
||||||
=================================================
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## ODOO: Menu maken voor Mailcatcher
|
|
||||||
|
|
||||||
Maak een Menu aan met de naam Mailcatcher
|
|
||||||
Hang deze aan de groep 'Internal User'
|
|
||||||
Action: ir.actions.act_url => Thirdparty apps
|
|
||||||
Klik door op 'Thirdparty apps' en verwijs de action URL naar de in nginx opgegeven naam (bijv: https://426-mailcatcher.staging.open2bizz.com/)
|
|
||||||
Zet het target op New Window
|
|
||||||
|
|
||||||
|
1. Login via Console
|
||||||
|
2. Stop Odoo:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
service odoo-server stop
|
||||||
|
sudo -u odoo python3 /odoo/odoo-server/odoo-bin neutralize -d productie
|
||||||
|
service odoo-server start
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
echo "";
|
|
||||||
echo "===================================";
|
|
||||||
echo "Install golang-go...";
|
|
||||||
echo "===================================";
|
|
||||||
apt-get -y install golang-go;
|
|
||||||
if [ $? == 0 ] ; then
|
|
||||||
echo 'golang-go installed'
|
|
||||||
else
|
|
||||||
echo 'ERROR: Installing golang-go NOT succesfull!'
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
echo "";
|
|
||||||
echo "===================================";
|
|
||||||
echo "Installing mailhog...";
|
|
||||||
echo "===================================";
|
|
||||||
go install github.com/mailhog/MailHog@latest;
|
|
||||||
if [ $? == 0 ] ; then
|
|
||||||
echo "";
|
|
||||||
echo "===================================";
|
|
||||||
echo "Mailcatcher installed succesfully!";
|
|
||||||
echo "===================================";
|
|
||||||
echo "";
|
|
||||||
else
|
|
||||||
echo 'ERROR: Installing Mailcatcher NOT succesfull!'
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
echo "===================================";
|
|
||||||
echo "Copy Mailhog to bin...";
|
|
||||||
echo "===================================";
|
|
||||||
sudo cp ~/go/bin/MailHog /usr/local/bin/MailHog
|
|
||||||
if [ $? == 0 ] ; then
|
|
||||||
echo 'Mailhog copied'
|
|
||||||
else
|
|
||||||
echo 'ERROR: Copy Mailhog NOT succesfull!'
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
echo "";
|
|
||||||
echo "===================================";
|
|
||||||
echo "Create MailHog service...";
|
|
||||||
echo "===================================";
|
|
||||||
sudo tee /etc/systemd/system/mailhog.service <<EOL
|
|
||||||
[Unit]
|
|
||||||
Description=MailHog
|
|
||||||
After=network.target
|
|
||||||
[Service]
|
|
||||||
User=root
|
|
||||||
ExecStart=/usr/bin/env /usr/local/bin/MailHog > /dev/null 2>&1 &
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOL
|
|
||||||
systemctl enable mailhog
|
|
||||||
systemctl start mailhog
|
|
||||||
echo "";
|
|
||||||
echo "===================================";
|
|
||||||
echo "Mailhog service created and started.";
|
|
||||||
echo "===================================";
|
|
||||||
Reference in New Issue
Block a user