1

I'm running the Seq docker image on an AWS EC2 instance.

In order to have the logs written to persistent storage, I've attached an EBS volume to the instance, and mounted it from within the instance with the rexray/ebs plugin:
docker plugin install rexray/ebs:latest REXRAY_PREEMPT=true EBS_REGION=eu-central-1a --grant-all-permissions EBS_ACCESSKEY=... EBS_SECRETKEY=...

docker volume create --driver rexray/ebs --name SeqData

Then instructed Seq to use that volume:
docker run -d --name seq -e ACCEPT_EULA=Y -v SeqData:/data -p 80:80 -p 5341:5341 datalust/seq:latest

Seq runs fine for a while (sometimes for a few hours, sometimes a few days), then I notice that the container is no longer running, and the AWS console shows that the volume has been detached. The AWS logs show that a DetachVolume event was initiated by the instance.

I reattach the volume manually in the AWS console, and restart the container. Seq resumes its normal operation, then after a while the phenomenon repeats itself.

The docker log doesn't give any hint. It just shows Seq logging its normal activity (retention, indexing, etc.) approximately every 5 minutes - up till about 10 minutes before the time that the detaching occurred.

I have limited experience with AWS or Docker, so I'll be grateful if anyone can help me out.

Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101
Dan Z
  • 696
  • 8
  • 19
  • 1
    Hi Dan! Are you passing `--memory=` and `--memory-swap=` to the `docker run` command? This is needed for Seq's resource management to work properly, and could be a cause of this behavior. Both flags need to be specified, and should have the same value (e.g. `4g`). – Nicholas Blumhardt Jan 02 '20 at 01:16
  • Thanks @NicholasBlumhardt! I'm now trying it out, hopefully I'll get back to you in a few days to report that all is well. BTW, I'm running on a t2.micro instance that has only 1GB RAM. So I obviously can't allocate 4g as per your example. How much should I allocate in this case (or is 1GB too small)? – Dan Z Jan 02 '20 at 06:01
  • 1 GB is tight, I haven't tried it, personally. Seq itself should load with under 100 MB, but performance will be patchy. 4 GB is usually the minimum I recommend; 3 GB is the "official" minimum on Windows. HTH! – Nicholas Blumhardt Jan 03 '20 at 22:37
  • @NicholasBlumhardt We're still under development, so I'm trying to make do with what I can get on a free plan. Once we move to production I will heed your advice. In any case, my problem seems to be solved. Can you please post your first comment as an answer so that I can accept it? – Dan Z Jan 05 '20 at 03:38
  • Done; thanks! I'll add a note to the docs, too. – Nicholas Blumhardt Jan 06 '20 at 21:53
  • Excuse me @DanZ how did you where able to run SEQ on EC2 instance? – advapi May 17 '22 at 12:17
  • @advapi here are detailed instructions: https://www.alexhyett.com/app-logs-dotnet-seq-5-serilog – Dan Z May 17 '22 at 13:57

1 Answers1

1

For Seq's memory management to work effectively, both --memory and --memory-swap need to be passed to the docker run command. Normally these should have the same value (i.e. no swap).

docker run --memory=4g --memory-swap=4g <other args> datalust/seq
Nicholas Blumhardt
  • 30,271
  • 4
  • 90
  • 101