diff options
| author | Robert Massaioli <rmassaioli@atlassian.com> | 2024-10-14 09:03:14 +1100 |
|---|---|---|
| committer | Robert Massaioli <rmassaioli@atlassian.com> | 2024-10-14 09:03:14 +1100 |
| commit | 3e68275ca3e72895c7af53d788eaa4e8d2c9889c (patch) | |
| tree | 906464f4d488d652ebcfcf20e094dfe223949867 | |
| parent | a7cb6d15c29e5e3936c7b77b6afaeab616be8940 (diff) | |
Uploaded useful scripts to help manage servers.
| -rw-r--r-- | readme.md | 26 | ||||
| -rw-r--r-- | util/delete-filesystems.bash | 17 |
2 files changed, 42 insertions, 1 deletions
@@ -55,7 +55,31 @@ For remote access, you'll need to: If you're creating a new Factorio deployment, provide these parameters when creating the stack. Otherwise, update your existing stack and provide these parameters.
-#### Uploading an existing save.
+#### Uploading and Downloading an existing save.
+
+##### Fast save upload (Recommended)
+
+Warning: Makes sure that your server is live and all EC2 and ECS healthchecks are green before trying this.
+
+Use the automation in `util/upload-save.bash` to upload your save file to your server, like so:
+
+``` bash
+bash util/upload-save.bash ~/path/to/my/save.zip $your_ec2_ip_or_remote_name
+```
+
+This is just an automated implementation of the slower version below.
+
+##### Fast save download (Recommended)
+
+Use the automation in `util/download-latest-save.bash` to download the latest (most recently played) save from a factorio server:
+
+``` bash
+bash util/download-latest-save.bash $your_ec2_ip_or_remote_name
+```
+
+Your server needs to be running for this to work and it should download your latest save to your local directory.
+
+##### Manual upload process (for understanding the system)
This procedure involves uploading your new save and then force killing the docker container. When the container is force killed it won't auto save, and the default logic is that on restart, the latest save will be loaded. To do this you must have SSH enabled via the CloudFormation deployment. The container must be running, otherwise you can't access EFS (where the save resides) from the EC2 instance.
diff --git a/util/delete-filesystems.bash b/util/delete-filesystems.bash new file mode 100644 index 0000000..dc5bbbd --- /dev/null +++ b/util/delete-filesystems.bash @@ -0,0 +1,17 @@ +# Get all of the filesystems to delete +# aws efs describe-file-systems --query "FileSystems[?Name!=null]|[?starts_with(Name, 'factorio-')].FileSystemId" --output text | cat + +# For each filesystem whose name starts with "factorio-" delete it. +# This is a very very dangerous script. Only use it if you know what you are doing. +# I recommend you download your save files first using download-latest-save.bash + +for fs_id in $(aws efs describe-file-systems --query "FileSystems[?Name!=null]|[?starts_with(Name, 'factorio-')].FileSystemId" --output text | cat) +do + echo "Deleting file system: $fs_id" + aws efs delete-file-system --file-system-id $fs_id + if [ $? -eq 0 ]; then + echo "Successfully deleted file system: $fs_id" + else + echo "Failed to delete file system: $fs_id" + fi +done
\ No newline at end of file |
