Skip to content

Add missing READMEs to templates, fix lint #1418

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

Merged
merged 1 commit into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions examples/cloud_development/argo-workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

Run and test Argo Workflows on a local Minkube instance.

The init_hook in this example configures minikube to store it's data in a local `home/` directory, so your host kubeconfig is not affected by this shell. The scripts in this example do the following:
The init_hook in this example configures minikube to store it's data in a local `home/` directory, so your host kubeconfig is not affected by this shell. The scripts in this example do the following:

`minikube` starts minikube and tails it's logs
`install-argo` Installs Argo Workflows based on the Argo Quickstart documentation
`argo-port-forward` Forwards the port of the Argo deployment, so you can access the Argo UI at `https://localhost:2746` (note the `https`).


## Usage Instructions

Note: macOS users need to have Docker Desktop installed. This is because the Docker Daemon cannot run natively on macOS

1. Start `minikube` by running `devbox run minikube`. This will install and spin up minikube in a local shell, and then tail the logs
2. Install argo on minkube using `devbox run argo-install`
3. Forward the ports from your argo deployment using `devbox run argo-port-forward`
4. You can now run `devbox shell`, and use the Argo CLI to interact with Argo in minikube. You can also access the Argo UI at https://localhost:2746
4. You can now run `devbox shell`, and use the Argo CLI to interact with Argo in minikube. You can also access the Argo UI at [https://localhost:2746](https://localhost:2746)
2 changes: 1 addition & 1 deletion examples/cloud_development/maelstrom/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ You can skip this step if you're running on Devbox.sh

1. You can now follow the docs and run the tests in the Maelstrom Docs + Readme. You can use `glow` from the command line to browse the docs.

This shell includes Ruby 3.10 for running the Ruby Demos. To run demos in other languages, install the appropriate runtimes using `devbox add`. For example, to run the Python demos, use `devbox add python310`.
This shell includes Ruby 3.10 for running the Ruby Demos. To run demos in other languages, install the appropriate runtimes using `devbox add`. For example, to run the Python demos, use `devbox add python310`.
4 changes: 2 additions & 2 deletions examples/cloud_development/temporal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ devbox run start-temporal

This will start the temporalite server for testing.

* You can view the WebUI at `localhost:8233`
* You can view the WebUI at `localhost:8233`
* By default, Temporal will listen for activities/requests on port `7233`

## Starting a Devbox Shell
Expand All @@ -28,7 +28,7 @@ This will start the temporalite server for testing.
devbox shell
```

This will activate a virtual environment and install the Temporal Python SDK.
This will activate a virtual environment and install the Temporal Python SDK.

## Testing the Temporal Workflows

Expand Down
12 changes: 6 additions & 6 deletions examples/databases/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ Use `devbox services start|stop [service]` to interact with services

## This plugin sets the following environment variables

* MYSQL_BASEDIR=/<projectDir>/.devbox/nix/profile/default
* MYSQL_HOME=/<projectDir>/.devbox/virtenv/mysql/run
* MYSQL_DATADIR=/<projectDir>/.devbox/virtenv/mysql/data
* MYSQL_UNIX_PORT=/<projectDir>/.devbox/virtenv/mysql/run/mysql.sock
* MYSQL_PID_FILE=/<projectDir>/.devbox/virtenv/mysql/run/mysql.pid
* MYSQL_BASEDIR=&lt;projectDir>/.devbox/nix/profile/default
* MYSQL_HOME=&lt;projectDir>/.devbox/virtenv/mysql/run
* MYSQL_DATADIR=&lt;projectDir>/.devbox/virtenv/mysql/data
* MYSQL_UNIX_PORT=&lt;projectDir>/.devbox/virtenv/mysql/run/mysql.sock
* MYSQL_PID_FILE=&lt;projectDir>/.devbox/virtenv/mysql/run/mysql.pid

To show this information, run `devbox info mysql`

Note that the `.sock` filepath can only be maximum 100 characters long. You can point to a different path by setting the `MYSQL_UNIX_PORT` env variable in your `devbox.json` as follows:

```
```json
"env": {
"MYSQL_UNIX_PORT": "/<some-other-path>/mysql.sock"
}
Expand Down
27 changes: 27 additions & 0 deletions examples/development/csharp/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
title: C# and .NET
---

C# and .NET projects can be easily generated in Devbox by adding the dotnet SDK to your project. You can then create new projects using `dotnet new`

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/csharp)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/dotnet)

## Adding .NET to your project

`devbox add dotnet-sdk`, or add the following to your `devbox.json`:

```json
"packages": [
"dotnet-sdk@latest"
],
```

This will install the latest version of the dotnet SDK. You can find other installable versions of the dotnet SDK by running `devbox search dotnet-sdk`.

If you need a specific version of the .NET SDK, you can search on [Nixhub](https://www.nixhub.io/search?q=dotnet)

## Creating a new C# Project

`dotnet new console -lang "C#" -o <name>`
Empty file.
3 changes: 1 addition & 2 deletions examples/development/elixir/elixir_hello/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Elixir

Basic Elixir project using Mix in Devbox.
Basic Elixir project using Mix in Devbox.

## Configuration

Expand Down Expand Up @@ -28,4 +28,3 @@ end
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/elixir_hello>.

25 changes: 25 additions & 0 deletions examples/development/fsharp/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: F# and .NET
---

F# and .NET projects can be easily generated in Devbox by adding the dotnet SDK to your project. You can then create new projects using `dotnet new`

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/fsharp)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/fsharp)

## Adding .NET to your project

`devbox add dotnet-sdk`, or add the following to your `devbox.json`:

```json
"packages": [
"dotnet-sdk@latest"
],
```

This will install the latest version of the dotnet SDK. You can find other installable versions of the dotnet SDK by running `devbox search dotnet-sdk`. You can also view the available versions on [Nixhub](https://www.nixhub.io/search?q=dotnet)

## Creating a new F# Project

`dotnet new console -lang "F#" -o <name>`
31 changes: 31 additions & 0 deletions examples/development/go/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Go
---

Go projects can be run in Devbox by adding the Go SDK to your project. If your project uses cgo or compiles against C libraries, you should also include them in your packages to ensure Go can compile successfully

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/go/hello-world)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/go)

## Adding Go to your Project

`devbox add go`, or add the following to your `devbox.json`

```json
"packages": [
"go@latest"
]
```

This will install the latest version of the Go SDK. You can find other installable versions of Go by running `devbox search go`. You can also view the available versions on [Nixhub](https://www.nixhub.io/packages/go)

If you need additional C libraries, you can add them along with `gcc` to your package list. For example, if libcap is required for yoru project:

```json
"packages": [
"go",
"gcc",
"libcap"
]
```
22 changes: 22 additions & 0 deletions examples/development/haskell/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Haskell
---

Haskell projects that use the Stack Framework can be run in Devbox by adding the Stack and the Cabal packages to your project. You may also want to include libraries that Stack requires for compilation (described below)

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/haskell/)

## Adding Haskell and Stack to your Project

`devbox add stack cabal-install zlib hpack`, or add the following to your `devbox.json`

```json
"packages": [
"stack@latest",
"cabal-install@latest",
"zlib@latest",
"hpack@latest"
]
```

This will install GHC, and the Haskell Tool Stack in your Devbox Shell at their latest version. You can find other installable versions of Stack by running `devbox search <pkg>`.
82 changes: 82 additions & 0 deletions examples/development/java/gradle/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
title: Java
---

In addition to installing the JDK, you'll need to install either the Maven or Gradle build systems in your shell.

In both cases, you'll want to first activate `devbox shell` before generating your Maven or Gradle projects, so that the tools use the right version of the JDK for creating your project.

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/java)

## Adding the JDK to your project

`devbox add jdk binutils`, or in your `devbox.json`

```json
"packages": [
"jdk@latest",
"binutils@latest"
],

```

This will install the latest version of the JDK. To find other installable versions of the JDK, run `devbox search jdk`.

Other distributions of the JDK (such as OracleJDK and Eclipse Temurin) are available in Nixpkgs, and can be found using [NixPkg Search](https://search.nixos.org/packages?channel=22.05&from=0&size=50&sort=relevance&type=packages&query=jdk#)

## Gradle

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/java/gradle/hello-world)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/java-gradle)

Gradle is a popular, multi-language build tool that is commonly used with JVM projects. To setup an example project using Gradle, follow the instructions below:

1. Create a project folder: `my-project/` and call `devbox init` inside it. Then add these packages: `devbox add jdk` and `devbox add gradle`.
- Replace `jdk` with the version of JDK you want. Get the exact nix-pkg name from `search.nixos.org`.
2. Then do `devbox shell` to get a shell with that `jdk` nix pkg.
3. Then do: `gradle init`
- In the generated `build.gradle` file, put the following text block:

```gradle
/* build.gradle */
apply plugin: 'java'
apply plugin: 'application'
/* Change these versions to the JDK version you have installed */
sourceCompatibility = 17
targetCompatibility = 17
mainClassName = 'hello.HelloWorld'
jar {
manifest {
/* assuming main class is in src/main/java/hello/HelloWorld.java */
attributes 'Main-Class': 'hello.HelloWorld'
}
}
```

- While in devbox shell, run `echo $JAVA_HOME` and take note of its value.
- Create a `gradle.properties` file like below and put value of `$JAVA_HOME` instead of <JAVA_HOME_VALUE> in the file.

```gradle
/* gradle.properties */
org.gradle.java.home=<JAVA_HOME_VALUE>
```

4. `gradle build` should compile the package and create a `build/` directory that contains an executable jar file.
5. `gradle run` should print "Hello World!".
6. Add `build/` to `.gitignore`.

An example `devbox.json` would look like the following:

```json
{
"packages": [
"gradle",
"jdk",
"binutils"
],
"shell": {
"init_hook": null
}
}
```
57 changes: 57 additions & 0 deletions examples/development/java/maven/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
title: Java
---

In addition to installing the JDK, you'll need to install either the Maven or Gradle build systems in your shell.

In both cases, you'll want to first activate `devbox shell` before generating your Maven or Gradle projects, so that the tools use the right version of the JDK for creating your project.

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/java)

## Adding the JDK to your project

`devbox add jdk binutils`, or in your `devbox.json`

```json
"packages": [
"jdk@latest",
"binutils@latest"
],

```

This will install the latest version of the JDK. To find other installable versions of the JDK, run `devbox search jdk`.

Other distributions of the JDK (such as OracleJDK and Eclipse Temurin) are available in Nixpkgs, and can be found using [NixPkg Search](https://search.nixos.org/packages?channel=22.05&from=0&size=50&sort=relevance&type=packages&query=jdk#)

## Maven

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/java/maven/hello-world)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/java-maven)

Maven is an all-in-one CI-CD tool for building testing and deploying Java projects. To setup a sample project with Java and Maven in devbox follow the steps below:

1. Create a dummy folder: `dummy/` and call `devbox init` inside it. Then add the nix-pkg: `devbox add jdk` and `devbox add maven`.
- Replace `jdk` with the version of JDK you want. Get the exact nix-pkg name from `search.nixos.org`.
2. Then do `devbox shell` to get a shell with that `jdk` nix pkg.
3. Then do: `mvn archetype:generate -DgroupId=com.devbox.mavenapp -DartifactId=devbox-maven-app -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeVersion=1.4 -DinteractiveMode=false`
- In the generated `pom.xml` file, replace java version in `<maven.compiler.source>` with the specific version you are testing for.
4. `mvn package` should compile the package and create a `target/` directory.
5. `java -cp target/devbox-maven-app-1.0-SNAPSHOT.jar com.devbox.mavenapp.App` should print "Hello World!".
6. Add `target/` to `.gitignore`.

An example `devbox.json` would look like the following:

```json
{
"packages": [
"maven",
"jdk",
"binutils"
],
"shell": {
"init_hook": null
}
}
```
2 changes: 1 addition & 1 deletion examples/development/nim/spinnytest/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nim Example

Small test to demonstrate installing a package and running it with nim.
Small test to demonstrate installing a package and running it with nim.

## Building

Expand Down
37 changes: 37 additions & 0 deletions examples/development/nodejs/nodejs-npm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: NodeJS
---

Most NodeJS Projects will install their dependencies locally using NPM or Yarn, and thus can work with Devbox with minimal additional configuration. Per project packages can be managed via NPM or Yarn.

[**Example Repo**](https://github.com/jetpack-io/devbox/tree/main/examples/development/nodejs)

[![Open In Devbox.sh](https://jetpack.io/img/devbox/open-in-devbox.svg)](https://devbox.sh/open/templates/node-npm)

## Adding NodeJS to your Shell

`devbox add nodejs`, or in your `devbox.json`:

```json
"packages": [
"nodejs@18"
],
```

This will install NodeJS 18, and comes bundled with `npm`. You can find other installable versions of NodeJS by running `devbox search nodejs`. You can also view the available versions on [Nixhub](https://www.nixhub.io/packages/nodejs)

## Installing Global Packages

In some situations, you may want to install packages using `npm install --global`. This will fail in Devbox since the Nix Store is immutable.

You can instead install these global packages by adding them to the list of packages in your `devbox.json`. For example: to add `yalc` and `pm2`:

```json
{
"packages": [
"nodejs@18",
"nodePackages.yalc@latest",
"nodePackages.pm2@latest"
]
}
```
Loading