Skip to content

Setting up on your local machine

Chen Hui Jing edited this page Aug 27, 2024 Β· 3 revisions

Make sure you have read and understand the General Drupal site‐building philosophy before actually doing any development work.

This is a Drupal 10 site. As such, your environment should be set up in a way that can run a Drupal site. The basic system requirements for a Drupal site are:

  • Web server

    • Apache 2.4.7 or higher, Nginx 1.1 or higher, or any other web server with proper PHP support.
    • More details about web server requirements.
  • Database (any one of the following options)

    • MySQL 5.7.8 (or greater)
    • MariaDB 10.3.7 (or greater)
    • Percona Server 5.7.8 (or greater)
    • PostgreSQL 10 (or greater)
    • SQLite 3.26 (or greater)
    • More details about database requirements.
  • Memory

    • Memory requirements RAM: Minimum required memory is 1GB to make sure Composer works. If you are running multiple modules or using memory-intensive tools such as Solr, or Memcache, considerably more memory may be needed.
    • PHP memory requirements: The minimum required memory size is 64 MB, typically 128 MB or 256 MB are found in production systems. For more, see PHP memory requirements. Be aware of the limitations of 32-bit PHP.
  • PHP

  • Disk space

    • Minimum 100MB. You will need more space if you install additional modules or themes, and you’ll also need space for media, backups, and other files generated by and uploaded to your site

If you are running macOS, you could try following the setup suggestions here: https://getgrav.org/blog/macos-sonoma-apache-multiple-php-versions. But as long as you can get a PHP site running on your local machine, that's all good and well.

Setting up interledger.org locally

Note: you will also need a copy of the latest database dump and the latest files folder. Until we set up some jobs that can do this automatically, we'll have to SSH into the production server to get this.

  1. Clone repository

    git clone [email protected]:interledger/interledger.org-v4.git
  2. Create sites folder and add settings.php and settings.local.php to the default folder inside

    .
    └── web/
        └── sites/
            └── default/
                β”œβ”€β”€ settings.php
                └── settings.local.php
  3. Set up the database configuration in the settings.php file

    $databases['default']['default'] = array (
      'database' => 'DB_NAME',
      'username' => 'DB_USER_NAME',
      'password' => 'DB_PASSWORD',
      'prefix' => '',
      'host' => 'localhost',
      'port' => '3306',
      'isolation_level' => 'READ COMMITTED',
      'namespace' => 'Drupal\\mysql\\Driver\\Database\\mysql',
      'driver' => 'mysql',
      'autoload' => 'core/modules/mysql/src/Driver/Database/mysql/',
    );
  4. Set up the config sync directory in the settings.php file (because we are dumping the contents of the files folder directly into the default folder)

    $settings['config_sync_directory'] = 'sites/default/files/config_4mhP4mzowBJ4Vu-Zgz4VRJeNAgvRZn7Gh2GBm_79fFn2zyqzRcphZh9XPG5_vdwLwTwfkrpzKA/sync';
  5. Extract the files backup into the default folder

    .
    └── web/
        └── sites/
            └── default/
                β”œβ”€β”€ files
                β”œβ”€β”€ settings.php
                └── settings.local.php
  6. Create new MYSQL database which matches the database name in the configuration and import database backup

    ./vendor/bin/drush sql-cli < DB_BACKUP.sql
  7. Check the Status Report page for any errors (admin/reports/status)

    1. You will need to create a private folder at the same level as the web folder and adjust permissions accordingly

Production server access (vague on purpose)

First of all, make sure you know what you're doing before proceeding. This is the production server and you could bring the website down if you mess things up.

  1. SSH into the AWS EC2 instance. You can find the instructions for this after logging into your AWS account. Go to EC2, then Instances, then the website instance, then Connect (in the top-right corner). The command and guidance is under the SSH client tab.
    ssh -i "PATH_TO_PEM_FILE" ec2-user@EC2_INSTANCE_PUBLIC_DNS
    
  2. To dump the production database, navigate to the document root (if you don't know where that is, ask in the tech-team channel, if you don't have access, you probably shouldn't be accessing the production server to begin with 乁⁠(⁠ β β€’⁠_⁠‒⁠ β )⁠ㄏ)
    ./vendor/bin/drush sql-dump > backupdb.sql
    
    scp -i "PATH_TO_PEM_FILE" ec2-user@EC2_INSTANCE_PUBLIC_DNS:/PATH_TO_SQL_FILE /LOCAL_MACHINE_PATH
    
  3. To get the asset files, zip up the files folder and download it to your local machine
    zip -r files.zip /PATH_TO_FILES_FOLDER
    
    scp -i "PATH_TO_PEM_FILE" ec2-user@EC2_INSTANCE_PUBLIC_DNS:/PATH_TO_FILES_ARCHIVE /LOCAL_MACHINE_PATH
    
  4. Please remember to remove the backup database and backup files folder from the EC2 instance once you've downloaded the files to your local machine.