Question

How to deploy local DDEV Drupal site to a droplet?

I suspect there are resources on this already, but I’m pretty new to deploying sites so I’ve likely missed them, and links to accessible documentation is great!

Basically once I have a local Drupal 11 project ready (using DDEV/Docker), what is a recommended workflow to deploy that on a DO droplet? Or if a droplet isn’t the way to go, what is?

Thanks!


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
March 31, 2025

Heya,

You can use either a droplet or an app platform. Whatever is easier for you. What you need to do if you want to have a Droplet is make sure the files/your app is on your Droplet.

The best way to do that, I think is create a github repository, upload your Application there and once you have a Droplet just pull the repo on it. Locally, you can do something like that

git init
git remote add origin git@github.com:yourusername/your-repo.git
git add .
git commit -m "Initial commit"
git push -u origin main

Now your repository will have your files. Now let’s go to the Droplet and how to prepare it. SSH to your Droplet(Ubuntu one) and run:

# Update system
sudo apt update && sudo apt upgrade -y

# Install Apache
sudo apt install apache2 -y

# Install MySQL
sudo apt install mysql-server -y

# Secure MySQL
sudo mysql_secure_installation

# Install PHP and required extensions
sudo apt install php php-mysql libapache2-mod-php php-cli php-gd php-xml php-mbstring php-curl php-zip unzip -y

Setup your Database;

sudo mysql -u root -p
CREATE DATABASE drupal;
CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON drupal.* TO 'drupaluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Now, you need Pull Your Project to the Droplet

cd /var/www/
sudo git clone https://github.com/yourusername/your-repo.git drupal
cd drupal
sudo chown -R www-data:www-data /var/www/drupal

Create a new config for Apache to server your website:

sudo nano /etc/apache2/sites-available/drupal.conf
<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/drupal/web

    <Directory /var/www/drupal/web>
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/drupal_error.log
    CustomLog ${APACHE_LOG_DIR}/drupal_access.log combined
</VirtualHost>

Enable site and rewrite

sudo a2ensite drupal
sudo a2enmod rewrite
sudo systemctl restart apache2
alexdo
Site Moderator
Site Moderator badge
March 31, 2025

Heya,

On top of what’s already been mentioned If your droplet has 1 GB RAM you can enable swap file and also using MySQL configutation tools like MySQL tunner to tweak the config for optimal performance:

https://www.digitalocean.com/community/questions/how-to-tweak-mysql-mariadb-configuration-for-increased-performance-and-stability

You can also check:

https://www.digitalocean.com/solutions/drupal-hosting

Regards

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.