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

Installation wizard #27

Open
6 tasks
thekid opened this issue Oct 28, 2022 · 1 comment
Open
6 tasks

Installation wizard #27

thekid opened this issue Oct 28, 2022 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@thekid
Copy link
Owner

thekid commented Oct 28, 2022

If freshly installed:

  • Ask user to create Atlas API key
  • Make user select filesystem location for media
  • Save this to an INI file
  • Create admin login
  • Create search indexes
  • Redirect to admin interface once Admin interface #26 is implemented
@thekid thekid added help wanted Extra attention is needed enhancement New feature or request labels Oct 28, 2022
@thekid
Copy link
Owner Author

thekid commented Oct 31, 2022

Create search indexes

We could do that using the Atlas Search API. We would need to ask users to create an API key in MongoDB Atlas for setting up Dialog, and enter public and private key in input fields. It would be great if Atlas were an OAuth provider where we could just request this access programmatically (much like Atlas CLI does!), but it doesn't seem there is a publicly documented way to do this.

use peer\http\DigestAuthorization;
use util\Secret;
use util\cmd\Console;
use webservices\rest\Endpoint;

// From https://cloud.mongodb.com/v2/622a7a8...b1#access/apiKeys/create
const PUBLIC_KEY = 'djfeabwg';
const PRIVATE_KEY= '...';

// Set up API with DigestAuth
$api= new Endpoint('https://cloud.mongodb.com/api/atlas/v1.0');
$api->with(['Authorization' => DigestAuthorization::fromChallenge(
  $api->resource('.')->get()->header('WWW-Authenticate'),
  PUBLIC_KEY,
  new Secret(PRIVATE_KEY)
)]);

// Access clusters. This is where we would perform the setup, creating users, databases, 
// search indexes etcetera
$r= $api->resource('clusters')->get();
Console::writeLine($r->value());

// [
//   links => [[
//     href => "https://cloud.mongodb.com/api/atlas/v1.0/clusters"
//     rel => "self"
//   ]]
//   results => [[
//     clusters => [[
//       alertCount => 0
//       authEnabled => true
//       availability => "available"
//       backupEnabled => false
//       clusterId => "631b94f...64"
//       dataSizeBytes => 0
//       name => "Dialog"
//       nodeCount => 3
//       sslEnabled => true
//       type => "replica set"
//       versions => ["5.0.13"]
//     ]]
//     groupId => "622a7a8...b1"
//     groupName => "Dialog"
//     orgId => "622a7a8...a5"
//     orgName => "Timm's Org - 2022-03-10"
//     planType => "Atlas"
//     tags => []
//   ]]
//   totalCount => 1
// ]

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

1 participant