Skip to content

Commit

Permalink
created new dev container environment. (#82)
Browse files Browse the repository at this point in the history
* created new dev container environment.

* removed junk data.

* switched from minikube to kind.

* creating devtest.yml
  • Loading branch information
TimothyStiles authored Aug 18, 2023
1 parent f0ed704 commit 059646a
Show file tree
Hide file tree
Showing 19 changed files with 131 additions and 64 deletions.
16 changes: 0 additions & 16 deletions .devcontainer/Dockerfile

This file was deleted.

23 changes: 23 additions & 0 deletions .devcontainer/dev/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
14 changes: 14 additions & 0 deletions .devcontainer/dev/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: ark-dev
description: Dev Helm chart for Ark developer environment
type: application
version: 0.0.0
appVersion: 1.20.2

# Bitnami charts are served from GitHub CDN - See https://github.com/bitnami/charts/issues/10539 for details
dependencies:
# Chart release date: 2023-07 (https://github.com/bitnami/charts/blob/main/bitnami/postgresql/Chart.yaml)
- name: postgresql
repository: oci://registry-1.docker.io/bitnamicharts
version: 12.6.6
condition: postgresql.enabled
Binary file added .devcontainer/dev/charts/postgresql-12.6.6.tgz
Binary file not shown.
4 changes: 4 additions & 0 deletions .devcontainer/dev/templates/configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-configmap
58 changes: 38 additions & 20 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.166.1/containers/ubuntu
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/kubernetes-helm-minikube
{
"name": "ark - Ubuntu",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick an Ubuntu version: focal, bionic
"args": { "VARIANT": "focal" }
},
"name": "ark-devcontainer",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",

// Set *default* container specific settings.json values on container create.
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {
"version": "latest",
"helm": "latest",
"minikube": "latest"
},
"ghcr.io/devcontainers/features/go:1": {
"version": "latest",
"golangciLintVersion": "latest"
},
"ghcr.io/mpriscella/features/kind:1": {
"version": "latest"
}
},

"extensions": ["golang.go","premparihar.gotestexplorer","github.vscode-pull-request-github","eamodio.gitlens"],

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["golang.go", "ms-vsliveshare.vsliveshare-pack","redhat.vscode-yaml","yzhang.markdown-all-in-one","premparihar.gotestexplorer","github.vscode-pull-request-github","streetsidesoftware.code-spell-checker","eamodio.gitlens"]
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "kubectl version",

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postStartCommand' to run commands after the container is created like starting minikube.
"postStartCommand": "kind create cluster && helm install dev .devcontainer/dev",
// "postStartCommand": "nohup bash -c 'minikube start &' > minikube.log 2>&1 && helm install dev .devcontainer/dev",

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",
// Configure tool-specific properties.
// "customizations": {},

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}

24 changes: 24 additions & 0 deletions .github/workflows/devtest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'build and test'
on:
push:
tags:
- v*
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Checkout (GitHub)
uses: actions/checkout@v3

- name: Build and run dev container task
uses: devcontainers/[email protected]
with:
imageName: ghcr.io/bebop/ark-devcontainer
cacheFrom: ghcr.io/bebop/ark-devcontainer
push: never
# Change this to be your CI task/script
runCmd: go test -v ./...
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ As one final guideline please be welcoming to newcomers and encourage new contri

Unsure where to begin contributing to ark? You can start by looking through these beginner and help-wanted issues:

[Beginner issues](https://github.com/TimothyStiles/ark/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner%22+) - issues which should only require a few lines of code, and a test or two.
[Beginner issues](https://github.com/bebop/ark/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner%22+) - issues which should only require a few lines of code, and a test or two.

[Good first issues](https://github.com/TimothyStiles/ark/contribute) - issues which are good for first time contributors.
[Good first issues](https://github.com/bebop/ark/contribute) - issues which are good for first time contributors.

[Help wanted issues](https://github.com/TimothyStiles/ark/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+) - issues which should be a bit more involved than beginner issues.
[Help wanted issues](https://github.com/bebop/ark/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22+) - issues which should be a bit more involved than beginner issues.

[Feature requests](https://github.com/TimothyStiles/ark/labels/enhancement) - before requesting a new feature search through previous feature requests to see if it's already been requested. If not then feel free to submit a request and tag it with the enhancement tag!
[Feature requests](https://github.com/bebop/ark/labels/enhancement) - before requesting a new feature search through previous feature requests to see if it's already been requested. If not then feel free to submit a request and tag it with the enhancement tag!

### Working on your first Pull Request?

Expand Down Expand Up @@ -108,11 +108,11 @@ If the answer to either of those two questions are "yes", then you're probably d

### Non-security related bugs

For non-security bug reports please [submit it using this template!](https://github.com/TimothyStiles/ark/issues/new?assignees=&labels=&template=bug_report.md&title=)
For non-security bug reports please [submit it using this template!](https://github.com/bebop/ark/issues/new?assignees=&labels=&template=bug_report.md&title=)

# How to suggest a feature or enhancement

If you want to suggest a feature it's as easy as filling out this [issue template](https://github.com/TimothyStiles/ark/issues/new?assignees=&labels=&template=feature_request.md&title=), but before you do please [check to see if it's already been suggested!](https://github.com/TimothyStiles/ark/labels/enhancement)
If you want to suggest a feature it's as easy as filling out this [issue template](https://github.com/bebop/ark/issues/new?assignees=&labels=&template=feature_request.md&title=), but before you do please [check to see if it's already been suggested!](https://github.com/bebop/ark/labels/enhancement)

# How add a recommended VSCode Plugin

Expand Down
2 changes: 1 addition & 1 deletion db/cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ var downloadCmd = &cobra.Command{
Short: "Download data for standard deploy build. Run at your own risk.",
Long: "Download literally downloads all the base data needed to build a standard ark deployment the amount of data is dummy high to casually test on your personal machine. Run at your own risk.",
Run: func(cmd *cobra.Command, args []string) {
download.ark()
// download.ark()
},
}
10 changes: 5 additions & 5 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"path/filepath"

"github.com/TimothyStiles/ark/pkg/env"
"github.com/bebop/ark/pkg/env"
)

// Read reads the config file and returns the config.
Expand Down Expand Up @@ -43,8 +43,8 @@ type Config struct {
// DataPath is the data directory of the project.
DataPath string `json:"data_path"`

// arkPath is the path to the ark sqlite database.
arkPath string `json:"ark_path"`
// ArkPath is the path to the ark sqlite database.
ArkPath string `json:"ark_path"`

// RheaRDF is the path to the Rhea RDF file.
RheaRDF string `json:"rhea_rdf"`
Expand Down Expand Up @@ -80,7 +80,7 @@ func DevDefault() Config {
IsProd: false,
RootPath: env.RootPath(),
DataPath: devPath,
arkPath: filepath.Join(devPath, "ark.sqlite"),
ArkPath: filepath.Join(devPath, "ark.sqlite"),
RheaRDF: filepath.Join(devPath, "rhea_mini.rdf.gz"),
RheaToUniprotSprot: filepath.Join(devPath, "rhea_to_uniprot_sprot.tsv.gz"),
RheaToUniprotTrembl: filepath.Join(devPath, "rhea_to_uniprot_trembl.tsv.gz"),
Expand All @@ -101,7 +101,7 @@ func ProdDefault() Config {
IsProd: true,
RootPath: env.RootPath(),
DataPath: prodPath,
arkPath: filepath.Join(prodPath, "ark.sqlite"),
ArkPath: filepath.Join(prodPath, "ark.sqlite"),
RheaRDF: filepath.Join(prodPath, "rhea.rdf.gz"),
RheaToUniprotSprot: filepath.Join(prodPath, "rhea_to_uniprot_sprot.tsv"),
RheaToUniprotTrembl: filepath.Join(prodPath, "rhea_to_uniprot_trembl.tsv"),
Expand Down
2 changes: 1 addition & 1 deletion pkg/download/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/TimothyStiles/ark/pkg/download"
"github.com/bebop/ark/pkg/download"
)

func TestFile(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/download/links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package download_test
import (
"testing"

"github.com/TimothyStiles/ark/pkg/download"
"github.com/bebop/ark/pkg/download"
)

func TestGetPageLinks(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/download/tarball_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"testing"

"github.com/TimothyStiles/ark/pkg/download"
"github.com/bebop/ark/pkg/download"
)

func TestTarball(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/insert/rhea.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package insert
import (
"context"

"github.com/TimothyStiles/ark/pkg/config"
"github.com/TimothyStiles/ark/pkg/rhea"
"github.com/bebop/ark/pkg/config"
"github.com/bebop/ark/pkg/rhea"
"github.com/jmoiron/sqlx"
"github.com/volatiletech/sqlboiler/v4/boil"
)
Expand Down
8 changes: 4 additions & 4 deletions pkg/insert/rhea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"path/filepath"
"testing"

"github.com/TimothyStiles/ark/pkg/config"
"github.com/TimothyStiles/ark/schema"
"github.com/bebop/ark/pkg/config"
"github.com/bebop/ark/schema"
"github.com/jmoiron/sqlx"
_ "modernc.org/sqlite"
)
Expand All @@ -23,12 +23,12 @@ func TestRhea(t *testing.T) {
}
defer os.RemoveAll(tmpDataDir)

tmpConfig.arkPath = filepath.Join(tmpDataDir, "rheaTest.db")
tmpConfig.ArkPath = filepath.Join(tmpDataDir, "rheaTest.db")

//create test database
err = schema.CreateDatabase(tmpConfig)

db, err := sqlx.Open("sqlite", tmpConfig.arkPath)
db, err := sqlx.Open("sqlite", tmpConfig.ArkPath)
if err != nil {
log.Fatalf("Failed to open sqlite in ark.db: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/rhea/rhea.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"strconv"
"strings"

"github.com/TimothyStiles/ark/models"
"github.com/bebop/ark/models"
"github.com/volatiletech/null/v8"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/rhea/rhea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"testing"

"github.com/TimothyStiles/ark/pkg/config"
"github.com/bebop/ark/pkg/config"
_ "github.com/mattn/go-sqlite3"
)

Expand Down
6 changes: 3 additions & 3 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"log"
"strings"

"github.com/TimothyStiles/ark/pkg/config"
"github.com/bebop/ark/pkg/config"
"github.com/huandu/go-sqlbuilder"
"github.com/jmoiron/sqlx"

Expand All @@ -17,7 +17,7 @@ func CreateDatabase(config config.Config) error {

// Begin SQLite
log.Println("Creating database...")
db, err := sqlx.Open("sqlite", config.arkPath)
db, err := sqlx.Open("sqlite", config.ArkPath)

if err != nil {
log.Fatalf("Failed to open sqlite database: %s", err)
Expand All @@ -41,7 +41,7 @@ func CreateDatabase(config config.Config) error {
log.Fatalf("Failed to execute schema: %s", err)
}

err = chemblAttach(db, config.arkPath)
err = chemblAttach(db, config.ArkPath)
if err != nil {
log.Fatalf("Failed to attach chembl with error %s", err)
}
Expand Down
4 changes: 2 additions & 2 deletions schema/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"path/filepath"
"testing"

"github.com/TimothyStiles/ark/pkg/config"
"github.com/bebop/ark/pkg/config"
"github.com/jmoiron/sqlx"

//"github.com/minio/minio-go/v7"
Expand All @@ -30,7 +30,7 @@ var db *sqlx.DB
func TestCreateDatabase(t *testing.T) {
tmpDataDir, err := ioutil.TempDir("", "data-*")
tmparkConfig := config.DevDefault()
tmparkConfig.arkPath = filepath.Join(tmpDataDir, "test.db")
tmparkConfig.ArkPath = filepath.Join(tmpDataDir, "test.db")
if err != nil {
t.Errorf("Failed to create temporary data directory")
}
Expand Down

0 comments on commit 059646a

Please sign in to comment.