Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
59 changes: 54 additions & 5 deletions .github/workflows/create-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ jobs:
env:
DEPLOY_SERVER_KEY: ${{ secrets.DEPLOY_SERVER_KEY }}
EVO_APP_DEPLOY_KEY: ${{ secrets.EVO_APP_DEPLOY_KEY }}
EVO_APP_DEPLOY_WRITE_KEY: ${{ secrets.EVO_APP_DEPLOY_WRITE_KEY }}
run: |
mkdir -p ~/.ssh

Expand All @@ -139,6 +140,12 @@ jobs:
printf '%s\n' "$EVO_APP_DEPLOY_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519

# Optional write key for pushing to configs repo
if [[ -n "$EVO_APP_DEPLOY_WRITE_KEY" ]]; then
printf '%s\n' "$EVO_APP_DEPLOY_WRITE_KEY" > ~/.ssh/id_ed25519_write
chmod 600 ~/.ssh/id_ed25519_write
fi

# SSH config
cat > ~/.ssh/config << 'EOL'
Host github.com
Expand Down Expand Up @@ -236,9 +243,21 @@ jobs:
DISK_SIZE: ${{ github.event.inputs.hpmn_disk_size }}
run: |
TFVARS_FILE="networks/$NETWORK_NAME.tfvars"
DEFAULT_MAIN_DOMAIN="networks.dash.org"

# Read current value from file (empty if not set)
CURRENT_SIZE=$(grep -oP 'hpmn_node_disk_size\s*=\s*\K[0-9]+' "$TFVARS_FILE" 2>/dev/null || echo "")
CURRENT_MAIN_DOMAIN=$(grep -oP 'main_domain\s*=\s*"\K[^"]*' "$TFVARS_FILE" 2>/dev/null || echo "")

# Generated tfvars leaves main_domain empty; ensure ACM DNS names are valid.
if [[ -z "$CURRENT_MAIN_DOMAIN" ]]; then
echo "Setting main_domain to $DEFAULT_MAIN_DOMAIN..."
if grep -q '^main_domain\s*=' "$TFVARS_FILE"; then
sed -i "s|^main_domain\\s*=.*|main_domain = \"$DEFAULT_MAIN_DOMAIN\"|" "$TFVARS_FILE"
else
echo "main_domain = \"$DEFAULT_MAIN_DOMAIN\"" >> "$TFVARS_FILE"
fi
fi

if [[ -n "$DISK_SIZE" && "$DISK_SIZE" != "$CURRENT_SIZE" ]]; then
if [[ ! "$DISK_SIZE" =~ ^[0-9]+$ ]]; then
Expand All @@ -257,6 +276,9 @@ jobs:
cat "$TFVARS_FILE"

- name: Deploy devnet (Terraform + Ansible)
env:
TF_IN_AUTOMATION: "true"
TF_CLI_ARGS_apply: "-auto-approve"
run: |
echo "============================================"
echo "Deploying $NETWORK_NAME"
Expand All @@ -267,22 +289,49 @@ jobs:
./bin/deploy -f "$NETWORK_NAME"

- name: Push configs to dash-network-configs
if: always()
env:
EVO_APP_DEPLOY_WRITE_KEY: ${{ secrets.EVO_APP_DEPLOY_WRITE_KEY }}
run: |
# Clone the configs repo to a temp directory
git clone [email protected]:dashpay/dash-network-configs.git /tmp/dash-network-configs

# Copy generated config files
cp "networks/$NETWORK_NAME.yml" /tmp/dash-network-configs/
cp "networks/$NETWORK_NAME.tfvars" /tmp/dash-network-configs/
cp "networks/$NETWORK_NAME.inventory" /tmp/dash-network-configs/
# Copy generated config files if present
COPIED=0
for ext in yml tfvars inventory; do
SRC="networks/$NETWORK_NAME.$ext"
if [[ -f "$SRC" ]]; then
cp "$SRC" /tmp/dash-network-configs/
COPIED=$((COPIED + 1))
else
echo "Skipping missing file: $SRC"
fi
done

if [[ $COPIED -eq 0 ]]; then
echo "No config files found to push"
exit 0
fi

# Commit and push
cd /tmp/dash-network-configs
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git add .
git commit -m "Add configs for $NETWORK_NAME" || echo "No changes to commit"
git push

# Use optional write key if configured; otherwise try default key.
if [[ -n "$EVO_APP_DEPLOY_WRITE_KEY" && -f "$HOME/.ssh/id_ed25519_write" ]]; then
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_ed25519_write -o StrictHostKeyChecking=no' git push || {
echo "::warning::Failed to push configs with EVO_APP_DEPLOY_WRITE_KEY"
exit 0
}
else
git push || {
echo "::warning::Failed to push configs (likely read-only EVO_APP_DEPLOY_KEY). Configure secret EVO_APP_DEPLOY_WRITE_KEY with write access."
exit 0
}
fi

echo "Configs pushed to dash-network-configs repo"

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/destroy-devnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ jobs:
echo ""

- name: Destroy devnet
env:
TF_IN_AUTOMATION: "true"
TF_CLI_ARGS_destroy: "-auto-approve"
run: |
chmod +x ./bin/destroy
./bin/destroy "$NETWORK_NAME" -t="$DESTROY_TARGET"
Expand Down
2 changes: 2 additions & 0 deletions ansible/roles/core_filebeat/vars/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ filebeat_output_elasticsearch_auth:
password: "{{ elastic_password }}"
filebeat_enable_logging: true
filebeat_log_level: info
# Keep SSL key var boolean to satisfy strict conditionals in newer ansible-core.
filebeat_ssl_key_file: false
3 changes: 3 additions & 0 deletions ansible/roles/dashd/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ dashd_allowprivatenet: '{% if dashd_externalip | ansible.utils.ipaddr("private")

dashd_compose_project_name: dashcore
dashd_compose_path: '{{ dashd_home }}/{{ dashd_compose_project_name }}'

# Wallet operations are only enabled on dedicated wallet nodes.
enable_wallet: false
13 changes: 8 additions & 5 deletions ansible/roles/dashd/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
block: |
wallet={{ wallet_rpc_wallet_faucet }}
wallet={{ wallet_rpc_wallet_mno }}
when: enable_wallet is true and wallet_exists.stat.exists is true
when: (enable_wallet | default(false) | bool) and wallet_exists.stat.exists is true

# TODO: why does this always take exactly 30 seconds on first deploy?
- name: Start dash core
Expand All @@ -126,14 +126,14 @@
cmd: dash-cli createwallet {{ wallet_rpc_wallet_faucet }}
creates: "{{ dashd_home }}/.dashcore/{{ dash_network_name if dash_network == 'devnet' else 'testnet3' }}/wallets/{{ wallet_rpc_wallet_faucet }}/wallet.dat"
register: create_faucet_wallet_result
when: enable_wallet is true
when: enable_wallet | default(false) | bool

- name: Create mno wallet
ansible.builtin.command:
cmd: dash-cli createwallet {{ wallet_rpc_wallet_mno }}
creates: "{{ dashd_home }}/.dashcore/{{ dash_network_name if dash_network == 'devnet' else 'testnet3' }}/wallets/{{ wallet_rpc_wallet_mno }}/wallet.dat"
register: create_mno_wallet_result
when: enable_wallet is true
when: enable_wallet | default(false) | bool

- name: Load wallets on startup
ansible.builtin.blockinfile:
Expand All @@ -142,10 +142,13 @@
block: |
wallet={{ wallet_rpc_wallet_faucet }}
wallet={{ wallet_rpc_wallet_mno }}
when: create_faucet_wallet_result.changed and create_mno_wallet_result.changed
when: >
(enable_wallet | default(false) | bool) and
(create_faucet_wallet_result is defined and create_faucet_wallet_result.changed) and
(create_mno_wallet_result is defined and create_mno_wallet_result.changed)

- name: Import faucet privkey
ansible.builtin.command: dash-cli -rpcwallet={{ wallet_rpc_wallet_faucet }} importprivkey {{ faucet_privkey }}
register: result
when: enable_wallet is true
when: enable_wallet | default(false) | bool
changed_when: result.rc == 0
4 changes: 4 additions & 0 deletions ansible/roles/eternal_terminal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
repo: ppa:jgmath2000/et
state: present
update_cache: true
register: et_repo
retries: 5
delay: 20
until: et_repo is succeeded

- name: Install ET
ansible.builtin.package:
Expand Down
4 changes: 3 additions & 1 deletion ansible/roles/multifaucet/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@
container: multifaucet-db-1
command: mysqladmin ping -u multifaucet --password="multifaucet"
register: response
until: response.stdout == "mysqld is alive"
failed_when: false
changed_when: false
until: "'mysqld is alive' in (response | to_json)"
retries: 10
delay: 10

Expand Down
2 changes: 1 addition & 1 deletion lib/configGenerator/generateTerraformConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function generateTerraformConfig(
masternode_arm_count: masternodesArmCount,
hp_masternode_amd_count: hpMasternodesAmdCount,
hp_masternode_arm_count: hpMasternodesArmCount,
main_domain: '""',
main_domain: '"networks.dash.org"',
main_host_arch: '"arm64"',
create_eip: false,
};
Expand Down
Loading