Deployment Always use development config, iRedMail Server Loco Config, and SystemD Service Configuration #1377
-
Hi, i've host my loco app in vps using Alma Linux 9.5, i compiled my app using this command cargo build --release and use systemd service to run my app path: /etc/systemd/system/app.service this is my app.service file [Unit]
Description=API Server
After=network.target
[Service]
User=bendo01
WorkingDirectory=/usr/share/nginx/html/server
Environment="APP_ENVIRONMENT=production"
Environment="RUST_BACKTRACE=1" # For debugging
ExecStart=/usr/share/nginx/html/server/xsia_loco-cli start -s
# EnvironmentFile=/usr/share/nginx/html/server/.env
Restart=on-failure
RestartSec=3
[Install]
WantedBy=multi-user.targe but when i run command sudo systemctl start app.service then sudo systemctl status app.service it's output use config/development.yaml to run app it's there configuration on .env file that i'm missing so my app use production.yaml? second, i've installed iRedMail smtp server and secure it with certbot certificate on my server, which port do i use? port 25 or 587? this is my env file ENV=production
REDIS_URL="redis://127.0.0.1"
DATABASE_URL="postgres://user:******@localhost:5432/my_app_db"
DATABASE_URL_TEST="postgres://user:******@localhost:5432/my_app_db"
DB_CONNECT_TIMEOUT="500"
DB_IDLE_TIMEOUT="500"
DB_MIN_CONNECTIONS="1"
DB_MAX_CONNECTIONS="1"
SMTP_HOST="mail.server.app"
SMTP_PORT=587
SMTP_USER="[email protected]"
SMTP_PASSWORD="*********"
SMTP_SENDER="My App" this is part of production.yaml # Mailer Configuration.
mailer:
# SMTP mailer configuration.
smtp:
# Enable/Disable smtp mailer.
enable: true
# SMTP server host. e.x localhost, smtp.gmail.com
host: {{ get_env(name="SMTP_HOST", default="mail.server.app") }}
# SMTP server port
port: {{ get_env(name="SMTP_PORT", default=587) }}
# Use secure connection (SSL/TLS).
secure: true
auth:
user: {{ get_env(name="SMTP_USER", default="[email protected]") }}
password: {{ get_env(name="SMTP_PASSWORD", default="*******") }}
# Override the SMTP hello name (default is the machine's hostname)
hello_name: {{ get_env(name="SMTP_SENDER", default="localhost") }} best regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Not sure where you got |
Beta Was this translation helpful? Give feedback.
Not sure where you got
APP_ENVIRONMENT
from—the expected environment variable isLOCO_ENV
.