######
# Metabase Report server Elastic Beanstalk configuration
# Modify the environmental variables below to customize your installation
# Comment out a variable to disable a feature
#####
container_commands:
    #customize_env:
        #env:
            #NGINX_FORCE_SSL: 1
            #PAPERTRAIL_HOSTNAME: $HOSTNAME
            #PAPERTRAIL_HOST: foobar.papertrailapp.com
            #PAPERTRAIL_PORT: 12345
            #PAPERTRAIL_FILES: /var/log/nginx/access.log /var/log/nginx/error.log
        #command: true
        #ignoreErrors: false

    # do server_https first to avoid overwriting other config changes
    01_server_https:
        command: ".ebextensions/metabase_config/metabase-setup.sh server_https"
        ignoreErrors: true

    02_log_x_real_ip:
        command: ".ebextensions/metabase_config/metabase-setup.sh log_x_real_ip"
        ignoreErrors: true

    03_install_papertrail:
        command: ".ebextensions/metabase_config/metabase-setup.sh install_papertrail"
        test: test $PAPERTRAIL_HOST
        ignoreErrors: true

    04_try_papertrail:
        command: "/sbin/service remote_syslog restart"
        test: test -e /etc/log_files.yml
        ignoreErrors: true

    05_try_nginx:
        command: "/sbin/service nginx restart"
        test: nginx -t
        ignoreErrors: false

option_settings:
  - namespace: aws:elasticbeanstalk:command
    option_name: Timeout
    value: 600
