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

feat: deploy command #295

Merged
merged 59 commits into from
Jul 12, 2023
Merged

feat: deploy command #295

merged 59 commits into from
Jul 12, 2023

Conversation

aorumbayev
Copy link
Collaborator

@aorumbayev aorumbayev commented Jun 28, 2023

Proposed changes

  • Introducing deploy command with the following behaviour:
    • By default grabs deploy configurations from hardcoded settings that rely on algonode for testnet/betanet/mainnet and localnet values for sandbox
    • By default assumes that network specific deployment command is specified in algokit.toml file otherwise expects it to be passed via the argument
    • If deployment is being performed to mainnet it will explicitly warn user whether he wants to continue otherwise user can pass --prod flag to skip the warning prompt
    • Deployer mnemonic is required to be passed explicitly via masked input interactively or directly as an argument (useful in CI), docs are to be improved to explicitly make it clear that dispenser is optional while deployer is required if deployment is being done to non localnet networks
    • As discussed and agreed with @achidlow @Loedn and @daniel-makerx , we are going ahead with support for .env.{any_network_name_or_default_networks} approach. That way user still has an option to pick our default localnet|betanet|testnet|mainnet algonode configs OR he defines {any_network_name_or_default_networks} in algokit.toml (or passed directly via flag) AND has a .env.[any_network_name_or_default_networks] to define network configurations

Examples

algokit.toml

[algokit]
min_version = "version_goes_her"

[deploy.localnet]
command = "command_goes_here"

[deploy.testnet]
command = "command_goes here"

OR user can have any custom name basically
[deploy.{any_network_name_or_default_networks}]
command = "command_goes_here"
and so on...

.env.[any_network_name_or_default_networks] file with expectations (same content as current .env content on beaker templates)

# Sandbox
ALGOD_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
ALGOD_SERVER=http://localhost
ALGOD_PORT=4001
INDEXER_TOKEN=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
INDEXER_SERVER=http://localhost
INDEXER_PORT=8980

User can also supply a single .env file without network name prefix, in this case algokit will load that if no env network prefixed file is available. This is useful for cases when deployments are always done to a single network.

Example commands:

algokit deploy {any_network_name_or_default_networks} 
algokit deploy {any_network_name_or_default_networks} --ci --prod 
algokit deploy localnet --custom-deploy command "echo HelloWorld" 

TODO

  • Unit/Snapshot tests
  • Documentation
  • Propagating changes to beaker prod template (env file has to be updated as well as algokit toml file

@aorumbayev
Copy link
Collaborator Author

@inaie-makerx @negar-abbasi tagging you for extra visibility so you are aware in case it overlaps with your items in any way. This will also involve some breaking changes on the beaker template mainly .env files and other configs would need to be placed at the root

src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
@aorumbayev
Copy link
Collaborator Author

@achidlow @daniel-makerx pushed next batch of tweaks, still need some more unit tests to be added but the approach is now refined as agreed with Adam

@aorumbayev aorumbayev requested a review from achidlow June 29, 2023 16:21
@github-actions
Copy link

github-actions bot commented Jun 29, 2023

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit
   __init__.py15753%6–13, 17–24, 32–34
   __main__.py220%1–3
src/algokit/cli
   completions.py105298%80, 95
   deploy.py55493%34–36, 78
   doctor.py48394%142–144
   generate.py30197%49
   goal.py30197%42
   init.py1901692%264–265, 315, 318–320, 331, 375, 401, 441, 450–452, 455–460, 473
   localnet.py91397%157, 178–179
src/algokit/core
   bootstrap.py1612485%103–104, 126, 149, 214, 217, 223–237, 246–251
   conf.py54885%10, 24, 28, 36, 38, 71–73
   deploy.py591083%60–63, 72–73, 77, 82, 89–91
   doctor.py65789%67–69, 92–94, 134
   log_handlers.py68790%50–51, 63, 112–116, 125
   proc.py45198%98
   sandbox.py1501590%100–107, 118, 226, 242, 257–259, 275
   typed_client_generation.py80594%55–57, 70, 75
   version_prompt.py73889%27–28, 40, 59–62, 80, 109
TOTAL148512492% 

Tests Skipped Failures Errors Time
232 0 💤 0 ❌ 0 🔥 16.946s ⏱️

@aorumbayev aorumbayev marked this pull request as ready for review June 30, 2023 12:00
src/algokit/cli/deploy.py Outdated Show resolved Hide resolved
@aorumbayev aorumbayev requested a review from achidlow July 11, 2023 07:05
@aorumbayev aorumbayev requested a review from daniel-makerx July 11, 2023 17:22
@aorumbayev aorumbayev requested a review from daniel-makerx July 12, 2023 07:44
Co-authored-by: Daniel McGregor <[email protected]>
@aorumbayev aorumbayev requested a review from daniel-makerx July 12, 2023 08:17
@aorumbayev aorumbayev merged commit f5a2826 into main Jul 12, 2023
@aorumbayev aorumbayev deleted the deploy-command branch July 12, 2023 09:28
achidlow pushed a commit that referenced this pull request Jul 13, 2023
… to deploy smart contracts to an Algorand network (#295)

---------
Co-authored-by: Altynbek Orumbayev <[email protected]>
Co-authored-by: Adam Chidlow <[email protected]>
Co-authored-by: Daniel McGregor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants