tag:support.appharbor.com,2010-11-23:/discussions/problems/100989-file-system-accessAppHarbor: Discussion 2019-08-30T12:34:27Ztag:support.appharbor.com,2010-11-23:Comment/470288122019-03-05T05:39:05Z2019-03-05T05:39:05ZFile System access<div><p>Hi,</p>
<p>You can't access the file system by other means than from your application code, but keep in mind that the filesystem is always wiped your app is redeployed (so that might be a way to trigger a reset in that sense if you need that). But it's relatively straightforward to check for the existence of files, and removing them if necessary, from your application code.</p>
<p>Can you perhaps tell me more about the use case though? I might be able to provide better advice with more information -- for instance, do you need to write files to the file system (which can be enabled from the "Settings" page for your app). Or are the files present in your repository but not your build output?</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/470288122019-03-05T07:25:11Z2019-03-05T07:25:11ZFile System accesspre { width: 92%; margin: 10px 2%; padding: 5px 2%; background: #efefef; border: 1px solid #d6d6d6 } blockquote { margin-left: 0; padding-left: 1em; border-left: 5px solid #ccc; }
<div class="mail_android_message">Rune,<br>
<br>
thanks for your quick response! I know that the files are always wiped if my app is redeployed. That’s why it creates restart files and up- and downloads them from an Amazon S3 bucket.<br>
<br>
Using putty would just be more convenient for checking these restart files and reading log files that implementing that all into my app.<br>
<br>
May I explain my app in more detail as you have suggested:<br>
Basically it’s a time parsing sport manager game. Users can register and manage a club. When the register phase is over, the game is started. Then, every minute a timer is called to increase the internal game time by - let’s say - an hour and to perform actions. That’s why the current state needs to be saved at every timer tick to be able to restore the state and all user inputs e.g. when an update of the app is performed.<br>
<br>
I recognized that the game timer is stopped after a while if I don’t access my app. Is it true that the app is closed completely after some time? If yes, is it possible to keep the game alive? This would be essential for this kind of app.<br>
<br>
Best Regards,<br>
Jan<br></div>
<div class="mail_android_quote">Am 05.03.2019, 06:39, rune <tender+d8e670802d@tenderapp.com> schrieb:
<blockquote class="gmail_quote">
<table width="100%">
<tr>
<td>
<p>// Please reply above this line<br>
==================================================</p>
<p><b>From</b>: rune (Support staff)</p>
<div>
<p>Hi,</p>
<p>You can't access the file system by other means than from your application code, but keep in mind that the filesystem is always wiped your app is redeployed (so that might be a way to trigger a reset in that sense if you need that). But it's relatively straightforward to check for the existence of files, and removing them if necessary, from your application code.</p>
<p>Can you perhaps tell me more about the use case though? I might be able to provide better advice with more information -- for instance, do you need to write files to the file system (which can be enabled from the "Settings" page for your app). Or are the files present in your repository but not your build output?</p>
<p>Best,<br>
Rune</p>
</div>
<div>
<p>On Mon, Mar 04 at 02:33 AM PST, ToniTurek wrote:</p>
<blockquote>
<div>
<p>My application is using temporary files to load a state if the app is restarted. I'm using Amazon S3 to permanenty store the files but for reading, I need them on the local file system.</p>
<p>Is there a way to investigate the local file system (for checking of existence, removing application files etc.) e.g. with Putty?</p>
</div>
</blockquote>
</div>
</td>
</tr>
<tr>
<td>
<p>Having trouble reading this? View this discussion online: <a href="http://support.appharbor.com/discussions/problems/100989-file-system-access">File System access</a>.</p>
<p>To unsubscribe and stop receiving emails from <a href="http://support.appharbor.com">http://support.appharbor.com</a>, visit <a href="http://support.appharbor.com/unsubscribe/385b030d046577696be16dec753eec8ccc10a0d6">this page</a></p>
</td>
</tr>
</table>
</blockquote>
</div>ToniTurektag:support.appharbor.com,2010-11-23:Comment/470288122019-03-07T01:26:10Z2019-03-07T01:26:10ZFile System access<div><p>Hi Jan,</p>
<p>So applications on the free plan will recycle after 20 minutes of inactivity, but you can upgrade to the Catamaran and Yacht plans to get a higher idle timeout (currently 24 hours on the paid plans). That should significantly lower the likelihood your app will ever be recycled during low-traffic periods.</p>
<p>Generally speaking I'd probably recommend approaches to maintaining application state that doesn't require manually inspecting stateful files on the server. In fact, that's part of the reason we don't support that and by default only allow read access to the application's directory - it can sometimes be easier to do this during development, but for isn't scalable and will cause issues and largely unnecessary maintenance over time.</p>
<p>Instead of writing code to allow you to inspect log and state files written by your app on the server, you might want to consider implementing a solution that relies on a suitable database that can be shared among workers for this.</p>
<p>Perhaps the AWS S3 approach you've implemented so far can be used instead of this - it sounds like the app can already handle a redeployment by saving objects in S3, so why not do that every time the application is restarted? You could maybe achieve that simply by cleaning the entire repository that writes local state files on each application startup, and always download the files from S3 instead. It seems that'd address the problem you're facing with little modification needed, and furthermore less of a need to manually inspect those files on the server?</p>
<p>Best,<br>
Rune</p></div>runetag:support.appharbor.com,2010-11-23:Comment/470288122019-03-08T19:51:16Z2019-03-08T19:51:16ZFile System access<div><p>Rune,<br>
thank you very much for your support so far!<br>
I have a follow-on questions:</p>
<p>Regarding the file upload to the AWD S3 storage, I'm using the following code:</p>
<p>uploadToS3(string BucketName, string Key, string File)<br>
{ try { PutObjectRequest putRequest = new PutObjectRequest { BucketName = BucketName, Key = Key, FilePath = File, ContentType = "application/zip" }; PutObjectResponse response = client.PutObject(putRequest); } catch (AmazonS3Exception e) { writeLog("Error: " + e.Message); } catch { writeLog("Unknown Error"); } }</p>
<p>The files I'm uploading are zip files.<br>
This code is working if I start my app from my local Visual Studio. I can see the files on AWD and download them again. But if I upload the code to AppHarbor, it throws an unknown exception.<br>
Do you have any hint to me what might be the problem?</p>
<p>Thanks in advance!<br>
Jan</p></div>ToniTurek