0

Je travaille sur le déploiement de l'application à travers haricots élastiques.Elastic Beanstalk, la configuration n'a jamais fonctionné?

Cependant, je l'ai remarqué que les fichiers de configuration ne sont jamais couru, je sais par:

J'ai mis une racine de document, quand je vais aux paramètres throught AWS est vide, j'ai mis un environnement Les variables qui sont également vides, mais quand il le définit manuellement à travers le site Web, ils fonctionnent bien, dans le journal des événements (en cours de déploiement), je devrais apparemment voir la sortie disant que la configuration a fonctionné avec succès. J'ai essayé chaque journal et il n'a été mentionné nulle part.

Je cours Laravel 5.4 et dossier .ebextensions est créé dans la racine du projet. A l'intérieur, j'ai 01-environment.config:

option_settings: 
    aws:elasticbeanstalk:container:php:phpini: 
    document_root: /public 
    memory_limit: 512M 
    aws:elasticbeanstalk:sqsd: 
    HttpPath: /worker/queue 
    aws:elasticbeanstalk:application:environment: 
    APP_ENV: production 
    APP_KEY: base64:MDKarorDueozTysvq50zDJET7es7MsVoTe3r001+xBs= 
    APP_DEBUG: true 

02-deploy.config

container_commands: 
     01-migrations: 
     command: "php artisan migrate --force" 
     command: "php artisan key:generate" 
     command: "php artisan config:clear" 
     command: "php artisan config:cache" 

    files: 
     "/opt/elasticbeanstalk/hooks/appdeploy/post/99_make_storage_writable.sh": 
     mode: "000755" 
     owner: root 
     group: root 
     content: | 
      #!/usr/bin/env bash 
      echo "Making /storage writeable..." 
      chmod -R 777 /var/app/current/storage 
      chmod -R 777 /var/app/current/bootstrap/cache 
      if [ ! -f /var/app/current/storage/logs/laravel.log ]; then 
       echo "Creating /storage/logs/laravel.log..." 
    owner: root 
    group: root 
    content: | 
     #!/usr/bin/env bash 
     echo "Making /storage writeable..." 
     chmod -R 777 /var/app/current/storage 
     chmod -R 777 /var/app/current/bootstrap/cache 
     if [ ! -f /var/app/current/storage/logs/laravel.log ]; then 
      echo "Creating /storage/logs/laravel.log..." 
      touch /var/app/current/storage/logs/laravel.log 
      chown webapp:webapp /var/app/current/storage/logs/laravel.log 
     fi 

     if [ ! -d /var/app/current/public/storage ]; then 
      echo "Creating /public/storage symlink..." 
      ln -s /var/app/current/storage/app/public /var/app/current/public/sto$ 
     fi 

    "/opt/elasticbeanstalk/tasks/publishlogs.d/laravel-logs.conf": 
     chown webapp:webapp /var/app/current/storage/logs/laravel.log 
     fi 

     if [ ! -d /var/app/current/public/storage ]; then 
      echo "Creating /public/storage symlink..." 
      ln -s /var/app/current/storage/app/public /var/app/current/public/sto$ 
     fi 

    "/opt/elasticbeanstalk/tasks/publishlogs.d/laravel-logs.conf": 
    mode: "000755" 
    owner: root 
    group: root 
    content: | 
     /var/app/current/storage/logs/*.log 

    "/etc/httpd/conf.d/https_redirect.conf": 
    mode: "000644" 
    owner: root 
    group: root 
    content: | 
     /var/app/current/storage/logs/*.log 

    "/etc/httpd/conf.d/https_redirect.conf": 
    mode: "000644" 
    owner: root 
    group: root 
    content: | 
     RewriteEngine on 
     RewriteCond %{HTTP:X-Forwarded-Proto} ^http$ 
     RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=307,L] 

Comme vous le voyez, j'ai redirect ici aussi, ce qui ne fonctionne pas comme il toujours aller sur http par par défaut, je ne reçois pas laravel sur S3 ni aucune autre commande. Quelqu'un sait pourquoi?

Répondre

0

/var/log/eb-activity.log doit afficher vos fichiers .config en cours d'exécution. Dans votre 02-deploy.config, il y a plusieurs problèmes.

  • Sous container_commands, vous ne pouvez avoir une commande par command:. Essayez quelque chose comme ceci:

    container_commands: 
        01-migrations: 
        command: "php artisan migrate --force" 
        02-generate-key: 
        command: "php artisan key:generate" 
        03-config-clear: 
        command: "php artisan config:clear" 
        04-config-cache: 
        command: "php artisan config:cache" 
    
  • Vous avez des espaces incohérents. Les fichiers YAML sont très sensibles aux espaces, donc assurez-vous que vous utilisez la même quantité de retrait (généralement deux espaces) par niveau.

  • Peut-être juste être un problème de copier/coller, mais la section 99_make_storage_writable.sh a quelques lignes en double.