archethic-foundation / aeweb-cli

AEWeb CLI to deploy files on Archethic
GNU Affero General Public License v3.0
5 stars 11 forks source link

Handle complex website #61

Closed Neylix closed 2 years ago

Neylix commented 2 years ago

This PR is the first implementation to solve the issue #60

Actually the CLI do:

This has been tested with actual archethic.net site and with wallet site.

But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression. So the next step will be to reduce content of a transaction to 3.5 MB max. We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address".

But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

Neylix commented 2 years ago

Here you can find the site I used to test. (I removed the white paper pdf because size was to big for Github) website.zip To handle over sized tx, you have to update node git apply patch.txt patch.txt

Neylix commented 2 years ago

Hi @Neylix

I tried to deploy a simple html file, but it failed.

web.zip

Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

manujuniris commented 2 years ago

Hi @Neylix I tried to deploy a simple html file, but it failed. web.zip Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

Hi @Neylix I tried to deploy a simple html file, but it failed. web.zip Can you please also update the README file in PR?

Yes I'll update the Readme later. As the PR is in draft, it will surely change again.

What is the error you got ?

Screenshot from 2022-05-27 12-49-03

Neylix commented 2 years ago

Screenshot from 2022-05-30 13-35-28

Yes there is a problem with getOriginKey API on testnet, try with a local node

Neylix commented 2 years ago

Screenshot from 2022-05-30 14-01-28

Single File deployment failed

It do not fail, this error is a problem in libjs. It is corrected in master but not pushed in npm version. If you go to the url you will see the file

manujuniris commented 2 years ago

Screenshot from 2022-05-30 14-01-28 Single File deployment failed

It do not fail, this error is a problem in libjs. It is corrected in master but not pushed in npm version. If you go to the url you will see the file

Screenshot from 2022-05-30 14-22-03

Can you display the complete transaction url along with filename and extension

manujuniris commented 2 years ago

Hello Julien

Screenshot from 2022-05-30 16-34-15

I just checked cli is not able to convert image file path to transaction url

gvqualite commented 2 years ago

This PR is the first implementation to solve the issue #60

Actually the CLI do:

  • Create a JSON object based on the directory tree
  • Compress file content using gzip to reduce size and encode the result in base64
  • Create a hosting transaction with stringified JSON object in the content
  • Ask user to validate fees
  • Send the transaction and show the website URL
  • Indicate to the user the current step during all flow

This has been tested with actual archethic.net site and with wallet site.

But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression. So the next step will be to reduce content of a transaction to 3.5 MB max. We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address".

But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

Hello,

It will be nice to open links to external links such as https ou ipfs, such as { “picture.png”:{ “href”:”ipfs://xxxxxxxxxx” }, “overview.mp4”:{ “href”:”http://xxxxxx” }, “app.js”:{ “href”:”archethic://000123456789“ } }

This is more flexible, not sure that we will store everything in ArchEthic and apps like I am développer will be able to implement different statregies.

It will be also a big limitation if we point to a transaction only on a content et not to another JSON description as children. For exemple, one transaction can contain a lib with js & css, (shared by other site) called from another transaction containing the website. Thanks to study this

Valette P

Neylix commented 2 years ago

This PR is the first implementation to solve the issue #60 Actually the CLI do:

  • Create a JSON object based on the directory tree
  • Compress file content using gzip to reduce size and encode the result in base64
  • Create a hosting transaction with stringified JSON object in the content
  • Ask user to validate fees
  • Send the transaction and show the website URL
  • Indicate to the user the current step during all flow

This has been tested with actual archethic.net site and with wallet site. But the problem is that both sites have a bigger size than the maximum content size allowed in a transaction, even after compression. So the next step will be to reduce content of a transaction to 3.5 MB max. We can split content in different transactions and refer the transaction address in the JSON object :

{
 "index.html":{
  "address":"000123456789"
 }
}

And so the node API will get the content of this file inside the transaction at "address". But for files above 3.5 MB we need to split the file, maybe by using esbuild for example.

Hello,

It will be nice to open links to external links such as https ou ipfs, such as { “picture.png”:{ “href”:”ipfs://xxxxxxxxxx” }, “overview.mp4”:{ “href”:”http://xxxxxx” }, “app.js”:{ “href”:”archethic://000123456789“ } }

This is more flexible, not sure that we will store everything in ArchEthic and apps like I am développer will be able to implement different statregies.

It will be also a big limitation if we point to a transaction only on a content et not to another JSON description as children. For exemple, one transaction can contain a lib with js & css, (shared by other site) called from another transaction containing the website. Thanks to study this

Valette P

Hi ! Thanks for your contribution :)

I don't really understand when you will use this because let's say you want to use the script from another transaction, in your html file you can directly use the url like:

<script src="archethic://000123456789"></script>
<img src="ipfs://xxxxxxxxxx" />

And so the browser will directly request for the good url