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

DevHub Grant: Development Environment Containerization #3

Merged
merged 3 commits into from
Feb 2, 2024

Conversation

njelich
Copy link
Contributor

@njelich njelich commented Feb 2, 2024

Development Environment Grant - Summary of Work


Overview:
Exciting progress has been made in enhancing the NEAR development environment to streamline the development and deployment of Rust smart contracts. This initiative aims to reduce barriers for new developers and improve the overall efficiency of the system. The focal point of this enhancement is the creation of a .devcontainer configuration in NEAR repositories, offering essential tools for convenient online and remote IDE editing and deployment of NEAR Rust smart contracts.


Key Contributions:

  1. Devcontainer Features:

    • Introduction of two new devcontainer features - cargo-near and near-cli-rs - simplifying the installation of the corresponding packages.
    • Resolved issues in the deployment pipeline for LLVM devcontainer feature and the publish feature GitHub action within the devcontainers-community organization.
  2. Devcontainer Configuration:

    • Comprehensive devcontainer configuration designed for an enhanced NEAR Rust development experience.
    • Inclusion of features for cargo-near, near-cli, LLVM, Rust, Docker-in-Docker for SourceScan, Git, and additional utilities.
    • Automation for opening relevant files in the Codespaces environment.
    • Configurations for future port forwarding to enable container-to-local accessibility.
    • Initialization script (init.sh) for pre-caching the NEAR protocol contract builder Docker container, ensuring reproducible builds with minimal wait times.
  3. Optimizations and Prebuilds:

    • Implementation of prebuilds on the main branch for swift image boot-up, reducing bootup time to less than a minute.

    • Recommendations for project maintainers to configure prebuild settings:

      1. Navigate to repository Settings, tick the Template repository checkmark
      2. Navigate to repository Settings > Codespaces (under Code and automation)
      3. Set up a new prebuild with the following configuration:
        • Set prebuild triggers to "Configuration change"
        • Enable region availability for all regions.
        • Add @njelich to failure notifications mailing list
    • Note: The same can be done on any fork, in case many codespaces starts are expected

  4. Usage Guide:

    • Click Use this template on the top right of the screen
    • Select Open in codespaces

Conclusion:
This pull request represents the culmination of efforts to significantly enhance the NEAR development environment, offering a robust foundation for Rust smart contract development. The comprehensive devcontainer configuration, optimizations, and prebuilds contribute to a seamless experience for both new and experienced developers. The usage guide ensures a smooth onboarding process, making NEAR Rust development more accessible and efficient for contributors.

Requesting review from @frol.

@njelich
Copy link
Contributor Author

njelich commented Feb 2, 2024

While awaiting merge and review, the current configuration can be tested on my downstream repo with prebuilds configured.

Copy link
Collaborator

@frol frol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Configuration looks fine to me. The only problem I observed is that the prebuilt images do not work if I start a new project by using the "Use template" button and creating a new repo. With that, it takes 20+ minutes to get the Codespace environment ready, which is a terrible developer experience. I want to merge this PR and see if this is the issue caused by that I started it from your fork, or if it is unrelated. We absolutely cannot afford more than 1 minute to boot up.

Another missing bit for the grant completion is the README, documentation, etc, and testing it out on developers who are not familiar with this initiative to collect the feedback and see if we can address it.

@frol frol merged commit 314dd33 into near:main Feb 2, 2024
3 of 4 checks passed
@Canvinus
Copy link

Canvinus commented Feb 3, 2024

https://near.social/sourcescan.near/widget/SourceScan?page=contract&contractId=codespace.near

The contract was built with "cargo build" using the "nearprotocol/contract-builder" without any issues. The build time was reasonably good. The only negative aspect I found regarding the UX is that the build folder does not appear in the web interface as soon as the build is completed, which might confuse the user.

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.

3 participants