This script automates the installation of a production-ready Discourse site on Ubuntu. It simplifies the process of setting up Discourse by handling the installation of dependencies, configuration, and deployment using Docker.
- Ubuntu 20.04 LTS or later
- Sudo privileges
- A domain name pointing to your server's IP address
-
Clone this repository or download the
install_discourse.sh
script to your Ubuntu server. -
Create a
.env
file in the same directory as the script with the following content:DISCOURSE_HOSTNAME=your_domain.com DISCOURSE_DEVELOPER_EMAILS=your_email@example.com DISCOURSE_SMTP_ADDRESS=smtp.example.com DISCOURSE_SMTP_PORT=587 DISCOURSE_SMTP_USER_NAME=your_smtp_username DISCOURSE_SMTP_PASSWORD=your_smtp_password LETSENCRYPT_ACCOUNT_EMAIL=your_email@example.com DB_PASSWORD=your_db_password # Optional REDIS_PASSWORD=your_redis_password # Optional
Replace the placeholder values with your actual information.
-
Make the script executable:
chmod +x install_discourse.sh
-
Run the script with sudo privileges:
sudo ./install_discourse.sh
-
Follow the on-screen prompts and wait for the installation to complete.
-
Once the installation is finished, visit
https://your_domain.com
to complete the Discourse setup process.
The script uses the values provided in the .env
file to configure Discourse. Here's what each variable means:
DISCOURSE_HOSTNAME
: Your domain name (e.g., forum.example.com)DISCOURSE_DEVELOPER_EMAILS
: Email address of the admin userDISCOURSE_SMTP_ADDRESS
: SMTP server address for sending emailsDISCOURSE_SMTP_PORT
: SMTP server port (usually 587 for TLS)DISCOURSE_SMTP_USER_NAME
: SMTP usernameDISCOURSE_SMTP_PASSWORD
: SMTP passwordLETSENCRYPT_ACCOUNT_EMAIL
: Email address for Let's Encrypt notificationsDB_PASSWORD
: (Optional) PostgreSQL database passwordREDIS_PASSWORD
: (Optional) Redis password
If DB_PASSWORD
and REDIS_PASSWORD
are not provided, the script will generate random passwords.
- This script is intended for a fresh installation on a clean Ubuntu system. Running it on a system with existing Docker configurations or another web server might cause conflicts.
- Make sure your domain's DNS is properly configured to point to your server before running the script.
- The script will install Docker and Docker Compose if they are not already present on your system.
- After installation, it's recommended to secure your server further by setting up a firewall and keeping the system updated.
- Regularly backup your Discourse data and keep your system and Discourse installation up to date.
If you encounter any issues during installation:
-
Check the Discourse logs:
cd /opt/discourse sudo ./launcher logs app
-
Ensure all required ports (80, 443) are open and not in use by other applications.
-
Verify that your
.env
file contains all required variables and that they are correctly set. -
If you need to rebuild the Discourse container:
cd /opt/discourse sudo ./launcher rebuild app
For more detailed troubleshooting and customization options, refer to the official Discourse Docker documentation.
For issues related to this installation script, please open an issue in this repository.
For general Discourse support, visit the official Discourse meta forum.
Remember to keep your .env
file and any logs containing sensitive information secure and never share them publicly when seeking support.