Objective:
In my company we are aiming to deploy our own server, following the docker compose guide or the local development environment guide posted on the documentation page.
Once we achieve that, I need confirmation whether the only thing that i will need to change in the following code is the url using my local server url:
namespace SpeckleSampleApp
{
class Program
{
static void Main(string[] args)
{
var account = new Account();
account.token = "YOUR-PERSONAL-ACCESS-TOKEN";
account.serverInfo = new ServerInfo
{
url = "https://app.speckle.systems/"
};
var client = new Client(account);
var stream = client.StreamGet("5dfbeb49c9").Result;
}
}
}
I’m also a little confused about the token variable since I have requested it using the speckle server frontend app. Is it fine if I keep using the same one?
The other question I have is whether I would be able to visualize the projects created programmatically in my own server in the speckle server frontend app dashboard?
When you generate the token, you are prompted to select scopes, you’ll probably want to select most stream and user scopes.
I recommend using AccountManager.GetServerInfo and AccountManager.GetUserInfo static functions to fetch the ServerInfo and UserInfo, rather than trying to create them manually. Some SDK functions will expect complete user and server information.
i.e.
static async void Main(string[] args)
{
Uri serverUrl = new("http://localhost"); //change this to your server url
const string authToken = "YOUR-PERSONAL-ACCESS-TOKEN"; //change this to your personal access token
var account = new Account();
account.token = authToken;
account.serverInfo = await AccountManager.GetServerInfo(serverUrl);
account.userInfo = await AccountManager.GetUserInfo(authToken, serverUrl);
Yep, you can continue to use this token indefinitely, it will remain active unless you revoke it (either via the frontend, or GraphQL),
Absolutely, projects created programmatically will appear in your own server’s frontend.
e.g.
using var client = new Client(account);
var projectCreateArgs = new ProjectCreateInput("My Project", "My Project Description", ProjectVisibility.Unlisted);
var project = await client.Project.Create(projectCreateArgs);
Wow, that looks quite sophisticated. I’m just curious, how does the frontend app is able to display the projects or models that were programmatically created using a custom url instead of the default one:
url = “https://app.speckle.systems/”
is that entirely handled by speckle?? or is there any particular section in the following guide:
that aids to maintain that connection?
if what you mentioned is true, then I don’t think I have any blockers for this week hehe
It’s also worth me mentioning incase you were thinking you needed to avoid using manager. This is not the case, you can use Manager to authenticate accounts for your custom server. you just need to specify your custom server url while adding the account.
This should be a bit easier than the manual auth via token we’ve discussed since you can fetch accounts via the various functions in AccountManager
If you plan on using other speckle connectors you’ll likley want to do this method.
My folks managed to run the speckle server in a “local virtual machine”. I could noticed that the local app comes packaged with a Frontend UI same as speckle.
Not sure when they have plans for deploying the server but when its ready I will replace the public url server over there:
Uri serverUrl = new("http://localhost"); //change this to your server url
Keep you posted. If you not here from me in a while is because we are still working on some automation scripts on Revit side before proceeding with publishing model into our own speckle server. Besides that, my folks also plan to orchestrate the deployment of the custom speckle server using azure services. So that’s a blocker for me before continuing exploring this aspect of the sdk.