By Michael
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!
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!
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
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:
You can also check:
https://www.digitalocean.com/solutions/drupal-hosting
Regards
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
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
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.