Developer Coding Environments
In platform engineering, one of the common challenges is ensuring that developers can quickly and consistently set up their coding environments, particularly when new developers join teams, developers switch between projects, or there's a need to scale. Automating the setup of developer environments can streamline onboarding and eliminate time lost due to misconfigurations or broken dependencies. By providing pre-configured environments or setup scripts, teams can focus on development rather than wasting time troubleshooting environmental inconsistencies.
The approach to managing developer environments can vary, but it often includes virtualization, containerization, and standardized templates that align with the organization’s needs. This can range from fully virtualized Windows environments to cloud-hosted containers for Linux development. Additionally, creating "start right" templates that promote consistency, best practices, and security as code is essential in maintaining a well-defined, repeatable process that scales across teams. This ensures that the development workflow not only starts smoothly but continues to adhere to best practices, keeping projects on track and compliant with security and operational standards.
Automating Setup of Developer Coding Environment
Developer coding environment bootstrapping and normalization can be a major challenge in engineering systems. Key issues include:
- Long onboarding times: It can take weeks for a new developer to contribute, especially when transferring developers between projects or bringing in contractors.
- Inconsistencies: Differences between developer environments and CI systems often lead to "it works on my machine" problems.
- Environment instability: Experimenting with or upgrading frameworks and software can break existing configurations, resulting in potentially lengthy and complex troubleshooting.
- Code review delays: Configuration changes needed for code reviews can slow down development as they need to be undone later.
- Ramp-up for all stakeholders: Non-development roles (like operators, QA, and business sponsors) also need to be trained and engaged, causing more delays.
To address these problems, standardizing and automating the setup of developer environments through tools, scripts, or containerized/virtualized environments can help. Pre-configured environments tailored to specific projects or organizational needs can ensure consistency, reduce setup time, and improve overall productivity.
Coding Environments for Windows and Linux
When targeting Windows for workstation replacement or full virtualization, virtual machines (VMs) generally provide the best functionality. This approach is beneficial for Windows client development, managing .NET full framework web applications, or maintaining Windows services. You can use cloud-hosted VMs like Microsoft Dev Box, which offers complete Windows workstation virtualization with integration to desktop management software. Alternatively, local VMs can be used with tools like HashiCorp Vagrant for managing environments, and HashiCorp Packer can be employed to build VM images for both Vagrant and Dev Box.
For targeting Linux, workspace virtualization is a better fit, focusing on project-specific or application-specific environments rather than replacing a full desktop. Cloud-hosted containers are a common choice, with options like GitHub Codespaces, which provides a cloud-based Dev Container environment compatible with VS Code, JetBrains IntelliJ, and terminal-based tools. If cloud options don’t meet your needs, VS Code's SSH or remote tunnel supports connecting to self-hosted Linux VMs. Additionally, local containers are an option if you prefer running Dev Containers locally. VS Code and IntelliJ provide robust support for these environments. For more flexibility, cloud-hosted VMs, where you can SSH directly into self-managed Linux VMs, can also be used. In cases where developers are working exclusively on Windows, the Windows Subsystem for Linux (WSL) offers a convenient local Linux development solution. WSL distributions can be exported and shared across teams. Cloud-based services like Microsoft Dev Box also support WSL for Linux development.
Using Application Templates for Consistency and Standardization
To promote consistency, standardization, and best practices across development teams, organizations can use application templates as part of an "everything as code" approach. These templates can streamline development, ensuring teams stay on the established paved paths. For organizations following a monorepo pattern, tools like the Azure Developer CLI (azd) can be used to create templates that include not only application source setups but also environment configurations and CI/CD workflows.
When creating templates for development, it's helpful to consider various key areas to ensure that the templates are comprehensive and consistent, adhering to best practices:
- Sample source code: Include sample source code to guide developers toward recommended languages, application models, services, APIs, SDKs, and architectural patterns.
- Build and deployment scripts: Incorporate scripts that offer a consistent way to trigger builds and deploy locally or to a sandbox environment. Ensure in-IDE or editor debug configurations are included to synchronize with CI/CD pipelines.
- CI/CD configuration: Provide workflows or pipelines for building and deploying applications, making use of reusable, centralized workflows. Treat these as "start right" templates and ensure they allow for manual triggering when needed.
- Infrastructure as Code (IaC) assets: Include recommended configurations and references to centrally managed modules to ensure infrastructure setups follow best practices.
- Security and policy as code assets: Add security-related configuration files, such as CODEOWNERS and dependabot.yaml, to incorporate security directly into the development process. Scheduled workflows for security scans, including tools like Microsoft Defender for Cloud, should be provided to embed security in the CI/CD pipeline and enhance supply chain security.
- Observability, monitoring, and logging: Provide setup configurations for monitoring tools, such as IaC for agent deployment or configuration-as-code for monitoring dashboards. Include sample code for logging and distributed tracing to ensure applications can be effectively monitored once deployed.
- Coding environment setup: Add configuration files for linters, formatters, and IDEs, and set up scripts for virtualized development environments like devcontainer.json, devbox.yaml, or Docker-related files.
- Test configuration: Supply files for unit testing and more extensive testing scenarios, using tools like Microsoft Playwright Testing or Azure Load Testing.
Collaboration tool setup: If supported, include task/issue templates or PR templates as code. Optionally, provide workflows that use available CLIs or APIs to update systems or configure collaboration tools like Microsoft Teams or Slack.