Puma phased-restart serving old assets












0















I'm having trouble with phased restarts on my puma production server.
The configuration of the production server is the following:



Rails app, running in a docker container.
three other docker images:
- redis
- solr
- nginx (as proxy)
I'm using docker-compose to run those containers.
+ an external Mysql server for the DB.



When I need to deploy new code, here's the workflow:




  1. Push new code to server

  2. migrate db if necessary (run rake db:migrate in the web container)

  3. precompile assets (run rake assets:precompile in the web container)

  4. restart the web server.


Here comes the trick: I would like to have zero downtime restart. So I tried using puma phased-restart instead of a web server restart.
But when I do that, the new rails code is deployed but the new assets aren't (despite rake assets:precompile).



Does anyone know how I can solve this?



PS: I know I should be using Capistrano, snce that's what pops up all the time when I googled my problem. But to be honest I don't know where to start with this, and it's a bit scary & discouraging. Especially since I'm also using this docker-compose setup which is quite complicated.



Here's the content of docker-compose.yml



version: "2"
services:
web:
build: .
command: bash -c "rails server -e production -p 3000 -b '0.0.0.0'"
volumes:
- .:/app
ports:
- "3000:3000"
- "9292:9292"
links:
- solr:solr
- redis
depends_on:
- solr
env_file:
- .env
entrypoint:
- /app/docker-entrypoint.sh
network_mode: bridge
restart: always
solr:
image: solr
ports:
- "8983:8983"
volumes:
- data:/opt/solr/server/solr/mycores
entrypoint:
- docker-entrypoint.sh
- solr-precreate
- qwerteach
network_mode: bridge
restart: always
redis:
image: redis:latest
ports:
- "6379"
network_mode: bridge
restart: always
proxy:
image: nginx:alpine
expose :
- "80"
volumes:
- ./proxy/qwprodpuma.conf:/etc/nginx/conf.d/qwprod.conf #- ./proxy/qwprod.conf:/etc/nginx/conf.d/qwprod.conf
links:
- web
environment:
- VIRTUAL_HOST=qwerteach.com, www.qwerteach.com
- LETSENCRYPT_HOST=qwerteach.com, www.qwerteach.com
- LETSENCRYPT_EMAIL=simon@hoggart.eu
- VIRTUAL_PORT=80
network_mode: bridge
restart: always

volumes:
data:









share|improve this question



























    0















    I'm having trouble with phased restarts on my puma production server.
    The configuration of the production server is the following:



    Rails app, running in a docker container.
    three other docker images:
    - redis
    - solr
    - nginx (as proxy)
    I'm using docker-compose to run those containers.
    + an external Mysql server for the DB.



    When I need to deploy new code, here's the workflow:




    1. Push new code to server

    2. migrate db if necessary (run rake db:migrate in the web container)

    3. precompile assets (run rake assets:precompile in the web container)

    4. restart the web server.


    Here comes the trick: I would like to have zero downtime restart. So I tried using puma phased-restart instead of a web server restart.
    But when I do that, the new rails code is deployed but the new assets aren't (despite rake assets:precompile).



    Does anyone know how I can solve this?



    PS: I know I should be using Capistrano, snce that's what pops up all the time when I googled my problem. But to be honest I don't know where to start with this, and it's a bit scary & discouraging. Especially since I'm also using this docker-compose setup which is quite complicated.



    Here's the content of docker-compose.yml



    version: "2"
    services:
    web:
    build: .
    command: bash -c "rails server -e production -p 3000 -b '0.0.0.0'"
    volumes:
    - .:/app
    ports:
    - "3000:3000"
    - "9292:9292"
    links:
    - solr:solr
    - redis
    depends_on:
    - solr
    env_file:
    - .env
    entrypoint:
    - /app/docker-entrypoint.sh
    network_mode: bridge
    restart: always
    solr:
    image: solr
    ports:
    - "8983:8983"
    volumes:
    - data:/opt/solr/server/solr/mycores
    entrypoint:
    - docker-entrypoint.sh
    - solr-precreate
    - qwerteach
    network_mode: bridge
    restart: always
    redis:
    image: redis:latest
    ports:
    - "6379"
    network_mode: bridge
    restart: always
    proxy:
    image: nginx:alpine
    expose :
    - "80"
    volumes:
    - ./proxy/qwprodpuma.conf:/etc/nginx/conf.d/qwprod.conf #- ./proxy/qwprod.conf:/etc/nginx/conf.d/qwprod.conf
    links:
    - web
    environment:
    - VIRTUAL_HOST=qwerteach.com, www.qwerteach.com
    - LETSENCRYPT_HOST=qwerteach.com, www.qwerteach.com
    - LETSENCRYPT_EMAIL=simon@hoggart.eu
    - VIRTUAL_PORT=80
    network_mode: bridge
    restart: always

    volumes:
    data:









    share|improve this question

























      0












      0








      0








      I'm having trouble with phased restarts on my puma production server.
      The configuration of the production server is the following:



      Rails app, running in a docker container.
      three other docker images:
      - redis
      - solr
      - nginx (as proxy)
      I'm using docker-compose to run those containers.
      + an external Mysql server for the DB.



      When I need to deploy new code, here's the workflow:




      1. Push new code to server

      2. migrate db if necessary (run rake db:migrate in the web container)

      3. precompile assets (run rake assets:precompile in the web container)

      4. restart the web server.


      Here comes the trick: I would like to have zero downtime restart. So I tried using puma phased-restart instead of a web server restart.
      But when I do that, the new rails code is deployed but the new assets aren't (despite rake assets:precompile).



      Does anyone know how I can solve this?



      PS: I know I should be using Capistrano, snce that's what pops up all the time when I googled my problem. But to be honest I don't know where to start with this, and it's a bit scary & discouraging. Especially since I'm also using this docker-compose setup which is quite complicated.



      Here's the content of docker-compose.yml



      version: "2"
      services:
      web:
      build: .
      command: bash -c "rails server -e production -p 3000 -b '0.0.0.0'"
      volumes:
      - .:/app
      ports:
      - "3000:3000"
      - "9292:9292"
      links:
      - solr:solr
      - redis
      depends_on:
      - solr
      env_file:
      - .env
      entrypoint:
      - /app/docker-entrypoint.sh
      network_mode: bridge
      restart: always
      solr:
      image: solr
      ports:
      - "8983:8983"
      volumes:
      - data:/opt/solr/server/solr/mycores
      entrypoint:
      - docker-entrypoint.sh
      - solr-precreate
      - qwerteach
      network_mode: bridge
      restart: always
      redis:
      image: redis:latest
      ports:
      - "6379"
      network_mode: bridge
      restart: always
      proxy:
      image: nginx:alpine
      expose :
      - "80"
      volumes:
      - ./proxy/qwprodpuma.conf:/etc/nginx/conf.d/qwprod.conf #- ./proxy/qwprod.conf:/etc/nginx/conf.d/qwprod.conf
      links:
      - web
      environment:
      - VIRTUAL_HOST=qwerteach.com, www.qwerteach.com
      - LETSENCRYPT_HOST=qwerteach.com, www.qwerteach.com
      - LETSENCRYPT_EMAIL=simon@hoggart.eu
      - VIRTUAL_PORT=80
      network_mode: bridge
      restart: always

      volumes:
      data:









      share|improve this question














      I'm having trouble with phased restarts on my puma production server.
      The configuration of the production server is the following:



      Rails app, running in a docker container.
      three other docker images:
      - redis
      - solr
      - nginx (as proxy)
      I'm using docker-compose to run those containers.
      + an external Mysql server for the DB.



      When I need to deploy new code, here's the workflow:




      1. Push new code to server

      2. migrate db if necessary (run rake db:migrate in the web container)

      3. precompile assets (run rake assets:precompile in the web container)

      4. restart the web server.


      Here comes the trick: I would like to have zero downtime restart. So I tried using puma phased-restart instead of a web server restart.
      But when I do that, the new rails code is deployed but the new assets aren't (despite rake assets:precompile).



      Does anyone know how I can solve this?



      PS: I know I should be using Capistrano, snce that's what pops up all the time when I googled my problem. But to be honest I don't know where to start with this, and it's a bit scary & discouraging. Especially since I'm also using this docker-compose setup which is quite complicated.



      Here's the content of docker-compose.yml



      version: "2"
      services:
      web:
      build: .
      command: bash -c "rails server -e production -p 3000 -b '0.0.0.0'"
      volumes:
      - .:/app
      ports:
      - "3000:3000"
      - "9292:9292"
      links:
      - solr:solr
      - redis
      depends_on:
      - solr
      env_file:
      - .env
      entrypoint:
      - /app/docker-entrypoint.sh
      network_mode: bridge
      restart: always
      solr:
      image: solr
      ports:
      - "8983:8983"
      volumes:
      - data:/opt/solr/server/solr/mycores
      entrypoint:
      - docker-entrypoint.sh
      - solr-precreate
      - qwerteach
      network_mode: bridge
      restart: always
      redis:
      image: redis:latest
      ports:
      - "6379"
      network_mode: bridge
      restart: always
      proxy:
      image: nginx:alpine
      expose :
      - "80"
      volumes:
      - ./proxy/qwprodpuma.conf:/etc/nginx/conf.d/qwprod.conf #- ./proxy/qwprod.conf:/etc/nginx/conf.d/qwprod.conf
      links:
      - web
      environment:
      - VIRTUAL_HOST=qwerteach.com, www.qwerteach.com
      - LETSENCRYPT_HOST=qwerteach.com, www.qwerteach.com
      - LETSENCRYPT_EMAIL=simon@hoggart.eu
      - VIRTUAL_PORT=80
      network_mode: bridge
      restart: always

      volumes:
      data:






      ruby-on-rails docker puma






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 27 '18 at 14:23









      RouliRouli

      678




      678
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53501825%2fpuma-phased-restart-serving-old-assets%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53501825%2fpuma-phased-restart-serving-old-assets%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)