Skip to content

Commit

Permalink
chore: fix broken devcontainer workflow; add gitpod (#2611)
Browse files Browse the repository at this point in the history
* chore: fix broken devcontainer workflow; add gitpod

* chore: fix db url

* chore: rm unused extensions

* chore: cat welcome message on start on gitpod

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
markphelps and kodiakhq[bot] authored Jan 4, 2024
1 parent 6d0d4d9 commit 770e807
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
8 changes: 5 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ ARG GO_VERSION=1.21

FROM golang:${GO_VERSION}

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

RUN apt-get update && \
apt-get -y install --no-install-recommends \
curl \
Expand Down Expand Up @@ -41,7 +39,11 @@ RUN go mod download -x

COPY . .

RUN mage bootstrap
ENV GOPATH=/workspace/go \
PATH=/workspace/go/bin:$PATH

# set the sqlite DB path to the user's home because of potential permission issues
ENV FLIPT_DB_URL=file:$HOME/flipt/flipt.db

EXPOSE 8080
EXPOSE 9000
10 changes: 6 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"go.useLanguageServer": true,
"go.formatTool": "goimports",
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast"]
"go.lintFlags": [
"--fast"
]
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
Expand All @@ -42,13 +44,13 @@
"onAutoForward": "notify"
}
},
// Uncomment the next line to run commands after the container is created - for example installing curl.
"postCreateCommand": "cat .devcontainer/welcome-message.txt"
"postCreateCommand": "mage bootstrap",
"postStartCommand": "cat .devcontainer/welcome-message.txt"
// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
// "remoteEnv": {}
}
}
7 changes: 3 additions & 4 deletions .devcontainer/welcome-message.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
👋 Welcome to "Flipt Development" in GitHub Codespaces!
👋 Welcome to "Flipt Development" in a Cloud Development Environment!

🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).

ℹ️ Look at https://github.com/flipt-io/flipt/blob/main/DEVELOPMENT.md for more contribution details.

⭐⭐ ================================= IMPORTANT!! ================================== ⭐⭐
- To run the backend server, run `mage go:run` in the terminal.
- To run the backend server, run `mage dev` in the terminal.

- To run the frontend server, from within the `ui` directory, run `npm run dev`
in the terminal (in a new tab).
- To run the frontend server, run `mage ui:dev` in the terminal (in a new tab).

- To run the tests, run `mage go:test` in the terminal.

Expand Down
5 changes: 5 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
image:
file: .devcontainer/Dockerfile
tasks:
- init: mage bootstrap
command: cat .devcontainer/welcome-message.txt
5 changes: 1 addition & 4 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"recommendations": [
"mutantdino.resourcemonitor",
"eamodio.gitlens",
"vsls-contrib.codetour",
"github.vscode-pull-request-github"
"mutantdino.resourcemonitor"
]
}
14 changes: 12 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,26 @@ To start the containers, run `docker-compose up` from the root of this repositor

## CDEs

Flipt also supports Containerized Development Environments (CDE) [VSCode Remote Containers](https://github.com/Microsoft/vscode-dev-containers)/[GitHub Codespaces](https://github.com/features/codespaces).
Flipt also supports Containerized Development Environments (CDE) [VSCode Remote Containers](https://github.com/Microsoft/vscode-dev-containers)/[GitHub Codespaces](https://github.com/features/codespaces)/[Gitpod](https://www.gitpod.io/).

These technologies allow you to quickly get setup with a Flipt development environment either locally or 'in the cloud'.

### VSCode Remote Containers

For VSCode Remote Containers (devcontainers), make sure you have [Docker](https://www.docker.com/get-started) and the [ms-vscode-remote.remote-containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension installed. Then simply clone this repo, open it in VSCode and run the [`Remote-Containers: Open Folder in Container`](https://code.visualstudio.com/docs/remote/containers#_quick-start-open-an-existing-folder-in-a-container) command in VSCode.

If you have access to [GitHub Codespaces](https://github.com/features/codespaces), simply open Flipt in a codespaces from the `Code` tab in the repo on GitHub or click the button below:
### GitHub Codespaces

Simply open Flipt in a codespaces from the `Code` tab in the repo on GitHub or click the button below:

[![Open in Codespaces](https://github.com/codespaces/badge.svg)](https://github.com/codespaces/new/?repo=flipt-io/flipt)

### Gitpod

To use [Gitpod](https://www.gitpod.io/), simply open Flipt in Gitpod by clicking the button below:

[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/flipt-io/flipt)

## devenv

[devenv](devenv.sh) is a solution that creates fast, declarative, reproducible, and composable developer environments using Nix.
Expand Down

0 comments on commit 770e807

Please sign in to comment.