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

Unable to used AWS location #1

Open
NeckBeardPrince opened this issue Jul 17, 2019 · 3 comments
Open

Unable to used AWS location #1

NeckBeardPrince opened this issue Jul 17, 2019 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@NeckBeardPrince
Copy link

$ wwb-cli spawn aws -w 2
Invalid command:
See --help for a list of available commands.

@Phara0h
Copy link
Owner

Phara0h commented Jul 30, 2019

That command does not work yet, if your interested in helping contributing to adding this functionality that would be cool.
aws cli code

How we currently do it is we made an aws instance that has a wasp running on it on startup (spin up as many as you want) and also one instance running the hive.

This is the bash script I wrote to start the hive for some sample code

#!/bin/bash
instance="i-1231231234"
aws-mfa
if [[ $(aws ec2 describe-instances --instance-ids $instance --query 'Reservations[].Instances[].State[].Name' --output text) = "running" ]] ; then \
    echo "Instance already started"; \
    elif [[ $(aws ec2 describe-instances --instance-ids $instance --query 'Reservations[].Instances[].State[].Name' --output text) = "stopped" ]] ; then \
    echo "Starting instance.." && aws ec2 start-instances --instance-ids $instance && aws ec2 wait instance-running --instance-ids $instance &&  echo "Instance started!"; \
    fi

ec2ip=$(aws ec2 describe-instances --instance-ids $instance --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text)
echo $ec2ip
echo "Saving WWB config.."
echo '{"instance":{"type":"remote","hive":{"ip":"'$ec2ip'","port":"4269","pid":null},"wasp":{"ip":"0.0.0.0"}},"wasps":[]}' > ${BASH_SOURCE%/*}/../config.json
echo "WWB config saved"
wwb-cli hive status --config ${BASH_SOURCE%/*}/../config.json

@Phara0h Phara0h added enhancement New feature or request help wanted Extra attention is needed labels Jul 30, 2019
@Phara0h
Copy link
Owner

Phara0h commented Aug 6, 2019

I decided I would start working on this, along with making the SDK. Stay tuned for its completion.

@Phara0h Phara0h self-assigned this Aug 6, 2019
@Phara0h
Copy link
Owner

Phara0h commented Aug 7, 2019

@NeckBeardPrince https://github.com/Phara0h/wwb-sdk Just pushed up the first WIP of the wwb-sdk that includes the spawning stuff you wanted. Here is how you use it.

const SDK = require('wwb-sdk');
const sdk = new SDK({path:require('path').resolve('./config/config.json')});

async function test()
{
  await sdk.Spawn.Aws.createSecurityGroup();
  await sdk.Spawn.Aws.createHiveInstance();
  await sdk.Spawn.Aws.createWaspsInstances(2);

  await sdk.Spawn.Aws.stopHiveInstance();
  await sdk.Spawn.Aws.stopWaspsInstances();

  await sdk.Spawn.Aws.startHiveInstance();
  await sdk.Spawn.Aws.startWaspsInstances();

  await sdk.Spawn.Aws.destoryHiveInstance();
  await sdk.Spawn.Aws.destoryWaspsInstances();
}

test();

Feel free to use this to just make a quick script to create the hive and as many wasps as you want. However, you could wait for me to refactor the wwb-cli to use the wwb-sdk and then not need to do this. Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants