DEV Community

Cover image for Dockerized-Drupal-and-PostgreSQL
Muhammad Awais Zahid
Muhammad Awais Zahid

Posted on

4

Dockerized-Drupal-and-PostgreSQL

Summary of Tasks:

  1. Create a virtual machine (EC2)
  2. Install docker & docker-compose
  3. Write a docker-compose file
  4. Execute your file
  5. Access your web server with VM public IP
  6. Connect your application with the database
  7. Watch my complete video of this project for troubleshooting

1. Create a virtual machine (EC2)

I have already made a complete video on how to make a virtual machine, you can use this link to watch the video on my channel.


2. Install docker & docker-compose



yum install docker -y
curl -SL https://github.com/docker/compose/releases/download/v2.20.3/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose;


Enter fullscreen mode Exit fullscreen mode

3. Write a docker-compose file



version: '3.1'

services:
  drupal:
    container_name: drupal
    image: drupal
    ports:
      - "80:80"
    volumes:
      - drupal_modules:/var/www/html/modules
      - drupal_profiles:/var/www/html/profiles
      - drupal_themes:/var/www/html/themes
      - drupal_sites:/var/www/html/sites
    networks:
      - drupal_net

  postgres:
    container_name: psql
    image: postgres
    environment:
      POSTGRES_PASSWORD: awais123
    volumes:
      - psql_data:/var/lib/postgresql/data
    networks:
      - drupal_net

volumes:
  drupal_modules:
  drupal_profiles:
  drupal_themes:
  drupal_sites:
  psql_data:

networks:
  drupal_net:


Enter fullscreen mode Exit fullscreen mode

4. Execute your file



docker-compose run -d


Enter fullscreen mode Exit fullscreen mode

5. Access your web server with VM public IP

Copy the public IP of your virtual machine and paste it into the web browser. you will see following interface, Choose English and select Choose Profile,

you will see following interface, Choose English and select Choose Profile,
Go to next section & choose standard

choose Standard

6. Connect your application with the database

Configure your database
Configure your database

Here is your final Application
Here is your final Application


7. Watch my complete video of this project for troubleshooting

I have already posted a video of this project on my channel If you face any issues and want to troubleshoot watch my complete video.

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

Billboard image

Try REST API Generation for Snowflake

DevOps for Private APIs. Automate the building, securing, and documenting of internal/private REST APIs with built-in enterprise security on bare-metal, VMs, or containers.

  • Auto-generated live APIs mapped from Snowflake database schema
  • Interactive Swagger API documentation
  • Scripting engine to customize your API
  • Built-in role-based access control

Learn more

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️