Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starter-kit Add pause and resume page #182

Merged
merged 3 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
---
title: Pause and Resume
description: If you've deployed an Avalanche L1, you can preserve and restore the state of your deployed Avalanche L1s.
updated: 2024-10-07
authors: [0xstt]
icon: BookOpen
---
import { Step, Steps } from 'fumadocs-ui/components/steps';

In this section, you’ll learn how to pause and resume your deployed Avalanche L1 using GitHub Codespaces. This will allow you to preserve the state of your blockchains and easily restore them when you return to development.

<Steps>

<Step>
### Restarting the Network After Codespace Pauses

With **GitHub Codespaces**, you can easily spin up and manage your Avalanche L1 blockchains. However, after a period of inactivity, Codespace instances will automatically pause, or you can stop them manually.

When you want to resume your work, start the Codespace instance again and follow these steps to restore your network.

1. **Start the Avalanche Network**
After restarting your Codespace instance, use the following command to restart your Avalanche network:

```bash
avalanche network start
```

Here’s what the output of this command looks like:

```bash
$ avalanche network start
Backend controller started, pid: 1781, output at: /home/vscode/.avalanche-cli/runs/server_20241007_035854/avalanche-cli-backend.log
Starting previously deployed and stopped snapshot
Booting Network. Wait until healthy...
Node logs directory: /home/vscode/.avalanche-cli/runs/network_20241007_035856/node<i>/logs

Network ready to use.

+------------------------------------------------------------------------------------------------------------------------------------+
| TESTEXP RPC URLS |
+-----------+------------------------------------------------------------------------------------------------------------------------+
| Localhost | http://127.0.0.1:9650/ext/bc/testexp/rpc |
| +------------------------------------------------------------------------------------------------------------------------+
| | http://127.0.0.1:9650/ext/bc/ZJ3iFLF2DJo31Koq7Ah2F7EwSmSCpXBG2LLX1bFhsdEfmxkWD/rpc |
+-----------+------------------------------------------------------------------------------------------------------------------------+
| Codespace | https://musical-lamp-5rgwvggj75xh777g-9650.app.github.dev/ext/bc/testexp/rpc |
| +------------------------------------------------------------------------------------------------------------------------+
| | https://musical-lamp-5rgwvggj75xh777g-9650.app.github.dev/ext/bc/ZJ3iFLF2DJo31Koq7Ah2F7EwSmSCpXBG2LLX1bFhsdEfmxkWD/rpc |
+-----------+------------------------------------------------------------------------------------------------------------------------+

+--------------------------------------------------------------------------------------------------------------------------------------+
| NODES |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| NAME | NODE ID | LOCALHOST ENDPOINT | CODESPACE ENDPOINT |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| node1 | NodeID-7Xhw2mDxuDS44j42TCB6U5579esbSt3Lg | http://127.0.0.1:9650 | https://musical-lamp-5rgwvggj75xh777g-9650.app.github.dev |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| node2 | NodeID-MFrZFVCXPv5iCn6M9K6XduxGTYp891xXZ | http://127.0.0.1:9652 | https://musical-lamp-5rgwvggj75xh777g-9652.app.github.dev |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| node3 | NodeID-NFBbbJ4qCmNaCzeW7sxErhvWqvEQMnYcN | http://127.0.0.1:9654 | https://musical-lamp-5rgwvggj75xh777g-9654.app.github.dev |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| node4 | NodeID-GWPcbFJZFfZreETSoWjPimr846mXEKCtu | http://127.0.0.1:9656 | https://musical-lamp-5rgwvggj75xh777g-9656.app.github.dev |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+
| node5 | NodeID-P7oB2McjBGgW2NXXWVYjV8JEDFoW9xDE5 | http://127.0.0.1:9658 | https://musical-lamp-5rgwvggj75xh777g-9658.app.github.dev |
+-------+------------------------------------------+-----------------------+-----------------------------------------------------------+

using awm-relayer version (v1.4.0)
Executing AWM-Relayer...
```

2. **Make Ports Public Again**
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make separate step

After the network starts, all ports are closed by default in Codespaces. You need to make the necessary ports public, like port `9650` for RPC access:

- Open the Codespace settings.
- Go to Ports.
- Select the row with the port 9650.
- Right Click > Port Visibility > Public.

![](/common-images/codespaces/ports-publish.png)
</Step>
<Step>
### Changing Timeout Duration for Codespaces
By default, Codespaces will pause after 30 minutes of inactivity. You can extend this period to up to 4 hours to avoid frequent pauses during development.

To configure the timeout duration:

1. In the upper-right corner of any page on GitHub, click your profile photo, then click **"Settings"**.
2. In the **"Code, planning, and automation"** section of the sidebar, click **"Codespaces"**.
3. Under **"Default idle timeout"**, enter the time that you want, then click Save. The time must be between 5 minutes and 240 minutes (4 hours).

![](/common-images/codespaces/specify-idle-timeout.png)

This will help keep your blockchain running for longer periods without interruption.

</Step>

<Step>

### Fee Considerations for Paid Users

If you're a paid user, be cautious about the costs associated with running long-running Codespaces. It's important to avoid undesired fees, especially if you're keeping instances alive for extended periods but also the resource usage. Memory, storage, traffic, and bandwidth usage can significantly impact costs if not managed properly.

You can manage these settings in GitHub:

1. In the upper-right corner of any page on GitHub, click your profile photo, then click **"Settings"**.
2. In the **"Access"** section of the sidebar, click **"Billing and Plans"**, and click **"Spending Limits"**.
3. Set a budget or limitation on Codespace usage to prevent unexpected fees. Leaving it at $0.00 will avoid any extra expenses.

![](/common-images/codespaces/specify-spending-limit.png)

</Step>



</Steps>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading