<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>

CC BY-SA 3.0
2016-10-15T18:13:26.457Z
Man. I've been slamming my head against the wall on this one for a few days. And there it is. Thanks!
Mats Mikkel Rummelhoff
CC BY-SA 3.0
2016-10-15T14:07:03.980Z
2016-10-15T17:55:07.797Z
2016-10-15T17:55:07.797Z
Richard Frank
<p>I keep on getting logged out whenever I deploy using Capistrano, despite the sessions being stored persistently (in the craft/storage folder). </p>

<session>
Keep on getting logged out when deploying using Capistano
# 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 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!  

---

