Last active
May 5, 2020 12:29
-
-
Save kraynel/d33fee5efe44656b7210d0cc11b6b63c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| require('/etc/phpmyadmin/config.secret.inc.php'); | |
| /* Ensure we got the environment */ | |
| $vars = array( | |
| 'PMA_ARBITRARY', | |
| 'PMA_HOST', | |
| 'PMA_HOSTS', | |
| 'PMA_VERBOSE', | |
| 'PMA_VERBOSES', | |
| 'PMA_PORT', | |
| 'PMA_PORTS', | |
| 'PMA_SOCKET', | |
| 'PMA_SOCKETS', | |
| 'PMA_USER', | |
| 'PMA_PASSWORD', | |
| 'PMA_ABSOLUTE_URI', | |
| 'PMA_CONTROLHOST', | |
| 'PMA_CONTROLPORT', | |
| 'PMA_PMADB', | |
| 'PMA_CONTROLUSER', | |
| 'PMA_CONTROLPASS', | |
| 'PMA_QUERYHISTORYDB' | |
| ); | |
| foreach ($vars as $var) { | |
| $env = getenv($var); | |
| if (!isset($_ENV[$var]) && $env !== false) { | |
| $_ENV[$var] = $env; | |
| } | |
| } | |
| if (isset($_ENV['PMA_QUERYHISTORYDB'])) { | |
| $cfg['QueryHistoryDB'] = boolval($_ENV['PMA_QUERYHISTORYDB']); | |
| } | |
| /* Arbitrary server connection */ | |
| if (isset($_ENV['PMA_ARBITRARY']) && $_ENV['PMA_ARBITRARY'] === '1') { | |
| $cfg['AllowArbitraryServer'] = true; | |
| } | |
| /* Play nice behind reverse proxys */ | |
| if (isset($_ENV['PMA_ABSOLUTE_URI'])) { | |
| $cfg['PmaAbsoluteUri'] = trim($_ENV['PMA_ABSOLUTE_URI']); | |
| } | |
| /* Figure out hosts */ | |
| /* Fallback to default linked */ | |
| $hosts = array('db'); | |
| /* Set by environment */ | |
| if (!empty($_ENV['PMA_HOST'])) { | |
| $hosts = array($_ENV['PMA_HOST']); | |
| $verbose = array($_ENV['PMA_VERBOSE']); | |
| $ports = array($_ENV['PMA_PORT']); | |
| } elseif (!empty($_ENV['PMA_HOSTS'])) { | |
| $hosts = array_map('trim', explode(',', $_ENV['PMA_HOSTS'])); | |
| $verbose = array_map('trim', explode(',', $_ENV['PMA_VERBOSES'])); | |
| $ports = array_map('trim', explode(',', $_ENV['PMA_PORTS'])); | |
| } | |
| if (!empty($_ENV['PMA_SOCKET'])) { | |
| $sockets = array($_ENV['PMA_SOCKET']); | |
| } elseif (!empty($_ENV['PMA_SOCKETS'])) { | |
| $sockets = explode(',', $_ENV['PMA_SOCKETS']); | |
| } | |
| /* Server settings */ | |
| for ($i = 1; isset($hosts[$i - 1]); $i++) { | |
| $cfg['Servers'][$i]['host'] = $hosts[$i - 1]; | |
| if (isset($verbose[$i - 1])) { | |
| $cfg['Servers'][$i]['verbose'] = $verbose[$i - 1]; | |
| } | |
| if (isset($ports[$i - 1])) { | |
| $cfg['Servers'][$i]['port'] = $ports[$i - 1]; | |
| } | |
| if (isset($_ENV['PMA_USER'])) { | |
| $cfg['Servers'][$i]['auth_type'] = 'config'; | |
| $cfg['Servers'][$i]['user'] = $_ENV['PMA_USER']; | |
| $cfg['Servers'][$i]['password'] = isset($_ENV['PMA_PASSWORD']) ? $_ENV['PMA_PASSWORD'] : ''; | |
| } else { | |
| $cfg['Servers'][$i]['auth_type'] = 'cookie'; | |
| } | |
| if (isset($_ENV['PMA_PMADB'])) { | |
| $cfg['Servers'][$i]['pmadb'] = $_ENV['PMA_PMADB']; | |
| $cfg['Servers'][$i]['relation'] = 'pma__relation'; | |
| $cfg['Servers'][$i]['table_info'] = 'pma__table_info'; | |
| $cfg['Servers'][$i]['table_coords'] = 'pma__table_coords'; | |
| $cfg['Servers'][$i]['pdf_pages'] = 'pma__pdf_pages'; | |
| $cfg['Servers'][$i]['column_info'] = 'pma__column_info'; | |
| $cfg['Servers'][$i]['bookmarktable'] = 'pma__bookmark'; | |
| $cfg['Servers'][$i]['history'] = 'pma__history'; | |
| $cfg['Servers'][$i]['recent'] = 'pma__recent'; | |
| $cfg['Servers'][$i]['favorite'] = 'pma__favorite'; | |
| $cfg['Servers'][$i]['table_uiprefs'] = 'pma__table_uiprefs'; | |
| $cfg['Servers'][$i]['tracking'] = 'pma__tracking'; | |
| $cfg['Servers'][$i]['userconfig'] = 'pma__userconfig'; | |
| $cfg['Servers'][$i]['users'] = 'pma__users'; | |
| $cfg['Servers'][$i]['usergroups'] = 'pma__usergroups'; | |
| $cfg['Servers'][$i]['navigationhiding'] = 'pma__navigationhiding'; | |
| $cfg['Servers'][$i]['savedsearches'] = 'pma__savedsearches'; | |
| $cfg['Servers'][$i]['central_columns'] = 'pma__central_columns'; | |
| $cfg['Servers'][$i]['designer_settings'] = 'pma__designer_settings'; | |
| $cfg['Servers'][$i]['export_templates'] = 'pma__export_templates'; | |
| } | |
| if (isset($_ENV['PMA_CONTROLHOST'])) { | |
| $cfg['Servers'][$i]['controlhost'] = $_ENV['PMA_CONTROLHOST']; | |
| } | |
| if (isset($_ENV['PMA_CONTROLPORT'])) { | |
| $cfg['Servers'][$i]['controlport'] = $_ENV['PMA_CONTROLPORT']; | |
| } | |
| if (isset($_ENV['PMA_CONTROLUSER'])) { | |
| $cfg['Servers'][$i]['controluser'] = $_ENV['PMA_CONTROLUSER']; | |
| } | |
| if (isset($_ENV['PMA_CONTROLPASS'])) { | |
| $cfg['Servers'][$i]['controlpass'] = $_ENV['PMA_CONTROLPASS']; | |
| } | |
| $cfg['Servers'][$i]['compress'] = false; | |
| $cfg['Servers'][$i]['AllowNoPassword'] = true; | |
| } | |
| for ($i = 1; isset($sockets[$i - 1]); $i++) { | |
| $cfg['Servers'][$i]['socket'] = $sockets[$i - 1]; | |
| $cfg['Servers'][$i]['host'] = 'localhost'; | |
| } | |
| /* | |
| * Revert back to last configured server to make | |
| * it easier in config.user.inc.php | |
| */ | |
| $i--; | |
| /* Uploads setup */ | |
| $cfg['UploadDir'] = ''; | |
| $cfg['SaveDir'] = ''; | |
| /* Include User Defined Settings Hook */ | |
| if (file_exists('/etc/phpmyadmin/config.user.inc.php')) { | |
| include('/etc/phpmyadmin/config.user.inc.php'); | |
| } | |
| /* Increase the session duration */ | |
| $sessionDuration = 60*60*24*7; // 60*60*24*7 = one week | |
| ini_set('session.gc_maxlifetime', $sessionDuration); | |
| $cfg['LoginCookieValidity'] = $sessionDuration; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "2" | |
| services: | |
| delivery-fpm: | |
| build: | |
| context: devops | |
| dockerfile: Dockerfile | |
| args: | |
| WITH_XDEBUG: "false" | |
| WITH_BLACKFIRE: "false" | |
| container_name: delivery-fpm | |
| environment: | |
| PHP_IDE_CONFIG: serverName=delivery | |
| XDEBUG_CONFIG: remote_host=dockerhost | |
| volumes: | |
| - .:/var/www/delivery:rw,cached | |
| delivery: | |
| image: nginx | |
| container_name: delivery | |
| depends_on: | |
| - delivery-fpm | |
| ports: | |
| - 8090:80 | |
| volumes: | |
| - ./devops/nginx.conf:/etc/nginx/conf.d/default.conf:ro | |
| - ./public:/var/www/delivery/public:ro | |
| delivery-db: | |
| image: mysql:5.7.17 | |
| container_name: delivery-db | |
| environment: | |
| - MYSQL_DATABASE=symfony | |
| - MYSQL_ROOT_PASSWORD=password | |
| ports: | |
| - 3306:3306 | |
| volumes: | |
| - ./devops/mysql:/docker-entrypoint-initdb.d:cached | |
| delivery-phpmyadmin: | |
| image: phpmyadmin/phpmyadmin | |
| container_name: delivery-phpmyadmin | |
| ports: | |
| - 8081:80 | |
| volumes: | |
| - ./devops/phpmyadmin/config.inc.php:/etc/phpmyadmin/config.inc.php | |
| environment: | |
| - MYSQL_DATABASE=symfony | |
| - MYSQL_ROOT_PASSWORD=password | |
| - PMA_VERBOSES=local,qual | |
| - PMA_HOSTS=delivery-db,dockerhost | |
| - PMA_PORTS=3306,3307 | |
| mailhog: | |
| image: mailhog/mailhog | |
| container_name: delivery-mailhog | |
| ports: | |
| - 8025:8025 | |
| blackfire-agent: | |
| image: blackfire/blackfire | |
| container_name: delivery-blackfire-agent | |
| restart: always | |
| dockerhost: | |
| image: qoomon/docker-host | |
| container_name: delivery-dockerhost | |
| cap_add: [ 'NET_ADMIN', 'NET_RAW' ] | |
| mem_limit: 8M | |
| restart: on-failure |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment