-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(restore-from-backup): The ability for users to provide existing …
…save game data on startup added (#8) * fix(backups): Fixed bug in IAM policy build when using s3 backups * fix(backups): Fixed bug preventing the backup script from generating with proper inputs when using S3 backups * feat(start-from-backup): Added the ability to use existing save files when creating the server.
- Loading branch information
1 parent
771871e
commit 9dfaee7
Showing
23 changed files
with
446 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
452200346,0002522bd69749ab9ffd03c48e20eca0,2024.01.21-22.22.51 |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Just Some Notes | ||
|
||
## EFS?!?! | ||
|
||
## Current Compute | ||
- EC2 | ||
|
||
Pros | ||
- Simple | ||
|
||
Cons | ||
- Not flexible | ||
- Updating a terraform module input that adjusts the user_data script that builds the ark configuration requires manual termination and recreation of the server. | ||
|
||
## Desired Compute | ||
- ASG | ||
|
||
### Driver | ||
|
||
The ark configuration is built during the first creation of the server when inputs are interpolated into the user_data template. To update the inputs users have to manually ssh and update. This creates an inconsistent state with the terraform configuration unless the user also updates the terraform configuration. Do no want to require users to update terraform code, such as adjusting Tameing speed rate, then force them to manually terminate the server and rerun the terraform apply to recreate it. | ||
|
||
### Goal | ||
|
||
1. Users want to update an Ark setting in the .ini so they make the input change in Terraform | ||
2. Users terraform apply | ||
3. ASG Launch config/user_data template updates | ||
4. ASG triggers recreation of the server | ||
5. Recreation downloads most up-to-date save data. | ||
|
||
### Challenges | ||
|
||
- Recreating the server every time takes approx 15 - 20 minutes due to user_data downloading ark. | ||
- - This can be avoided by providing a custom AMI with ark preinstalled, but this requires users to initially create an AMI. Scope creep and can be potentially off putting to users. | ||
- No mechanism to force ark to save before destroy | ||
- No mechanism to start the new server with an existing save - planned feature | ||
|
||
### Pros | ||
- Provides flexibility. Updating a terraform module input that adjusts the user_data script that builds the ark configuration triggers an auto rebuild of the server. | ||
- Immutable compute layer | ||
|
||
### Cons | ||
- More complex | ||
- Increased risk to users in form of unintended scaling up ( $$$$ ) | ||
- Potential loss of data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Start From Backup | ||
|
||
## Related Ark Arguments | ||
|
||
? | ||
|
||
## Notes on Saves | ||
- Character profile data .arkprofil | ||
- Map data .ark | ||
- Tribe profiles .arktributetrive | ||
|
||
## Driver | ||
Players want to use existing save data and migrate to AWS or have lost their server, but have backups and want to restore from the backup files. | ||
|
||
## Outcome | ||
The ability for users to start an Ark server with existing save data | ||
|
||
## Deliverables | ||
- A Mechanism for users to inform Terraform on the location of existing save data | ||
- Supported save data locations determined and supported | ||
|
||
## Flow | ||
- Start server :white-check-mark: | ||
- Make backups :white-check-mark: ( shipped to s3) | ||
- Server explodes | ||
- Start new server | ||
- Place backups on new erver | ||
- Start new server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Starting an Ark Server From Existing Save Data ( Restoring from Backup ) | ||
An example of using the inputs required to start the server with existing save data. | ||
|
||
## Details | ||
These inputs are required when migrating from an existing server with existing data or recovering from a deleted server. | ||
|
||
> [!WARNING] | ||
> When `backup_files_storage_type = "s3"` using The objects in the S3 bucket must not be compressed and must be in the root of the S3 bucket. The bucket's root directroy will be synced to the SaveGame directory. | ||
> [!WARNING] | ||
> When `backup_files_storage_type = "local"` using The objects/files in the directory you specify with `backup_files_local_path` must not be compressed. Terraform will iterate through each file in that directory and upload it to the root of an S3 bucket it creates. | ||
- `backup_files_storage_type = "local"` will instruct terraform to create an S3 bucket named `ark-bootstrap-local-saves-region-accID` and upload the save files from your local PC `backup_files_local_path` directory specified to that bucket. The user_data script on the EC2 instance will download the files from that S3 bucket when the server starts and place them in the `/ark-asa/ShooterGame/Saved/SaveGames` directory. | ||
|
||
- `backup_files_storage_type = "s3"` Is informing terraform that you have an existing S3 bucket somewhere that contains the save game data. The EC2 user_data script will attempt to sync the root of that S3 bucket with the SaveGames directory of ark. That is why it is important that the objects be uncompressed and in the root of the directory. | ||
|
||
> [!WARNING] | ||
> When `backup_files_storage_type = "local"` using The objects/files in the directory you specify with `backup_files_local_path` must not be compressed. Terraform will iterate through each file in that directory and upload it to the root of an S3 bucket it creates. | ||
## Usage - Restore From Local Files | ||
Relevant inputs: | ||
|
||
```HCL | ||
start_from_backup = true | ||
backup_files_storage_type = "local" | ||
backup_files_local_path = "../../assets" | ||
``` | ||
|
||
> [!WARNING] | ||
> When `backup_files_storage_type = "s3"` using The objects in the S3 bucket must not be compressed and must be in the root of the S3 bucket. The bucket's root directroy will be synced to the SaveGame directory. | ||
## Usage - Restore From an Existing S3 Bucket ( Bring Your Own S3 Bucket) | ||
Relevant inputs: | ||
|
||
```HCL | ||
start_from_backup = true | ||
backup_files_storage_type = "s3" | ||
existing_backup_files_bootstrap_bucket_arn = "arn:aws:s3:::ark-existing-s3-bucket-bootstrap" | ||
existing_backup_files_bootstrap_bucket_name = "ark-existing-s3-bucket-bootstrap" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
module "asa" { | ||
source = "../.." | ||
|
||
# Infrastructure inputs | ||
ge_proton_version = "8-27" | ||
instance_type = "t3.xlarge" | ||
create_ssh_key = true | ||
ssh_public_key = "../../ark_public_key.pub" | ||
# Ark Application inputs | ||
use_battleye = false | ||
auto_save_interval = 20.0 | ||
ark_session_name = "ark-aws-ascended" | ||
max_players = "32" | ||
enable_rcon = true | ||
rcon_port = 27011 | ||
steam_query_port = 27015 | ||
game_client_port = 7777 | ||
server_admin_password = "RockwellSucks" | ||
is_password_protected = true | ||
join_password = "RockWellSucks" | ||
# Custom GameUserSettings.ini inputs | ||
use_custom_gameusersettings = true | ||
custom_gameusersettings_s3 = true | ||
game_user_settings_ini_path = "../../TestGameUserSettings.ini" | ||
custom_gameusersettings_github = false | ||
custom_gameusersettings_github_url = "" | ||
# Custom Game.ini inputs | ||
use_custom_game_ini = true | ||
custom_gameini_s3 = true | ||
game_ini_path = "../../TestGame.ini" | ||
custom_gameini_github = false | ||
custom_gameini_github_url = "" | ||
# Backup inputs | ||
enable_s3_backups = true | ||
backup_s3_bucket_name = "" | ||
backup_s3_bucket_arn = "" | ||
backup_interval_cron_expression = "*/5 * * * *" | ||
create_backup_s3_bucket = true | ||
s3_bucket_backup_retention = 7 | ||
force_destroy = true | ||
# Restore settings | ||
start_from_backup = true | ||
backup_files_storage_type = "local" | ||
backup_files_local_path = "../../assets" | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
terraform { | ||
required_version = ">= 1.5.0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.