Answers.Body: <p>The problem is that the basepath changes each time you deploy (Capistrano uses versioned release directories). The basepath is used to generate a session key, which is invalidated each time a new deployment is made.</p>
  
  <p>The answer is to add the <code>appId</code> parameter to <code>config/general.php</code>. <a href="https://craftcms.com/docs/config-settings#appId" rel="noreferrer">The docs</a> give a good explanation</p>
  
  <blockquote>
    <p>The application ID, which is used for things like storing data caches and user sessions. If it’s not set, Craft will automatically generate one based on the server path. Setting it will help avoid the loss of data caches and user sessions when Craft is deployed using a deployment script that will store Craft in an inconsistent location, such as Capistrano.</p>
  </blockquote>
  
  <p>So add this to <code>general.php</code>:</p>
  
  <pre><code>'appId' =&gt; 'chooseyourownrandomstring',
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-15T18:13:26.457Z
Answers.Text: Man. I've been slamming my head against the wall on this one for a few days. And there it is. Thanks!
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-10-15T14:07:03.980Z
Answers.LastActivityDate: 2016-10-15T17:55:07.797Z
Answers.LastEditDate: 2016-10-15T17:55:07.797Z
Answers.UserDisplayName: Richard Frank
Body: <p>I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder). </p>
  
Tags: <session>
Title: Keep on getting logged out when deploying using Capistano
ThreadText: # Keep on getting logged out when deploying using Capistano
  
  (Asked by: username_0 on 2016-10-15)
  
  I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder).
  
  **Tags:** session
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-10-15. Score: 5
  
  The problem is that the basepath changes each time you deploy (Capistrano uses versioned release directories). The basepath is used to generate a session key, which is invalidated each time a new deployment is made.
  
  The answer is to add the `appId` parameter to `config/general.php`. [The docs](https://craftcms.com/docs/config-settings#appId) give a good explanation
  
  > The application ID, which is used for things like storing data caches and user sessions. If it’s not set, Craft will automatically generate one based on the server path. Setting it will help avoid the loss of data caches and user sessions when Craft is deployed using a deployment script that will store Craft in an inconsistent location, such as Capistrano.
  
  So add this to `general.php`:
  
  ```
  'appId' => 'chooseyourownrandomstring',
  
  ```
  
  > **Comments:**
  > **username_1**: Man. I've been slamming my head against the wall on this one for a few days. And there it is. Thanks!  
  
  ---
  
  