diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 20af2f68a..000000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -// Place your settings in this file to overwrite default and user settings. -{ -} \ No newline at end of file diff --git a/api/datastore/mysql/mysql_test.go b/api/datastore/mysql/mysql_test.go index 2d422fc25..f7879a93a 100644 --- a/api/datastore/mysql/mysql_test.go +++ b/api/datastore/mysql/mysql_test.go @@ -16,9 +16,9 @@ const tmpMysql = "mysql://root:root@tcp(%v:3307)/funcs" func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func()) { fmt.Println("initializing mysql for test") - tryRun(logf, "remove old mysql container", exec.Command("docker", "rm", "-f", "iron-mysql-test")) + tryRun(logf, "remove old mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test")) mustRun(fatalf, "start mysql container", exec.Command( - "docker", "run", "--name", "iron-mysql-test", "-p", "3307:3306", "-e", "MYSQL_DATABASE=funcs", + "docker", "run", "--name", "func-mysql-test", "-p", "3307:3306", "-e", "MYSQL_DATABASE=funcs", "-e", "MYSQL_ROOT_PASSWORD=root", "-d", "mysql")) maxWait := 16 * time.Second wait := 2 * time.Second @@ -75,7 +75,7 @@ func prepareMysqlTest(logf, fatalf func(string, ...interface{})) (func(), func() } }, func() { - tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-f", "iron-mysql-test")) + tryRun(logf, "stop mysql container", exec.Command("docker", "rm", "-f", "func-mysql-test")) } } diff --git a/api/datastore/postgres/postgres_test.go b/api/datastore/postgres/postgres_test.go index 44552057b..c9266699f 100644 --- a/api/datastore/postgres/postgres_test.go +++ b/api/datastore/postgres/postgres_test.go @@ -16,8 +16,8 @@ const tmpPostgres = "postgres://postgres@%v:15432/funcs?sslmode=disable" func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), func()) { fmt.Println("initializing postgres for test") - tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "iron-postgres-test")) - mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "iron-postgres-test", "-p", "15432:5432", "-d", "postgres")) + tryRun(logf, "remove old postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test")) + mustRun(fatalf, "start postgres container", exec.Command("docker", "run", "--name", "func-postgres-test", "-p", "15432:5432", "-d", "postgres")) wait := 1 * time.Second for { @@ -50,19 +50,19 @@ func preparePostgresTest(logf, fatalf func(string, ...interface{})) (func(), fun } fmt.Println("postgres for test ready") return func() { - db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP())) - if err != nil { - fatalf("failed to connect for truncation: %s\n", err) - } - for _, table := range []string{"routes", "apps", "extras"} { - _, err = db.Exec(`TRUNCATE TABLE ` + table) + db, err := sql.Open("postgres", fmt.Sprintf(tmpPostgres, datastoretest.GetContainerHostIP())) if err != nil { - fatalf("failed to truncate table %q: %s\n", table, err) + fatalf("failed to connect for truncation: %s\n", err) } - } - }, + for _, table := range []string{"routes", "apps", "extras"} { + _, err = db.Exec(`TRUNCATE TABLE ` + table) + if err != nil { + fatalf("failed to truncate table %q: %s\n", table, err) + } + } + }, func() { - tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-f", "iron-postgres-test")) + tryRun(logf, "stop postgres container", exec.Command("docker", "rm", "-f", "func-postgres-test")) } } @@ -96,4 +96,4 @@ func mustRun(fatalf func(string, ...interface{}), desc string, cmd *exec.Cmd) { if err := cmd.Run(); err != nil { fatalf("failed to %s: %s", desc, b.String()) } -} \ No newline at end of file +} diff --git a/api/datastore/redis/redis_test.go b/api/datastore/redis/redis_test.go index a1cae0d65..639c8b44e 100644 --- a/api/datastore/redis/redis_test.go +++ b/api/datastore/redis/redis_test.go @@ -17,8 +17,8 @@ const tmpRedis = "redis://%v:6301/" func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func()) { fmt.Println("initializing redis for test") - tryRun(logf, "remove old redis container", exec.Command("docker", "rm", "-f", "iron-redis-test")) - mustRun(fatalf, "start redis container", exec.Command("docker", "run", "--name", "iron-redis-test", "-p", "6301:6379", "-d", "redis")) + tryRun(logf, "remove old redis container", exec.Command("docker", "rm", "-f", "func-redis-test")) + mustRun(fatalf, "start redis container", exec.Command("docker", "run", "--name", "func-redis-test", "-p", "6301:6379", "-d", "redis")) timeout := time.After(20 * time.Second) for { @@ -41,7 +41,7 @@ func prepareRedisTest(logf, fatalf func(string, ...interface{})) (func(), func() fmt.Println("redis for test ready") return func() {}, func() { - tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-f", "iron-redis-test")) + tryRun(logf, "stop redis container", exec.Command("docker", "rm", "-f", "func-redis-test")) } } diff --git a/api/runner/dind/Dockerfile b/api/runner/dind/Dockerfile deleted file mode 100644 index 4a2565036..000000000 --- a/api/runner/dind/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -FROM docker:1.13.1-dind - -RUN apk update && apk upgrade && apk add --no-cache ca-certificates - -COPY entrypoint.sh /usr/local/bin/ -COPY dind.sh /usr/local/bin/ - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - -# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT, so that this is called) -# CMD ["./runner"] diff --git a/api/runner/dind/README.md b/api/runner/dind/README.md deleted file mode 100644 index 227bacbb5..000000000 --- a/api/runner/dind/README.md +++ /dev/null @@ -1,2 +0,0 @@ -This is the base image for all Titan's docker-in-docker images. - diff --git a/api/runner/dind/build.sh b/api/runner/dind/build.sh deleted file mode 100755 index 6b84dbd58..000000000 --- a/api/runner/dind/build.sh +++ /dev/null @@ -1,22 +0,0 @@ - -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -set -ex - -docker build -t iron/dind:latest . - -cd go-dind -docker build -t iron/go-dind:latest . diff --git a/api/runner/dind/chaos/Dockerfile b/api/runner/dind/chaos/Dockerfile deleted file mode 100644 index a8f1926f2..000000000 --- a/api/runner/dind/chaos/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -# iron/dind-chaos -FROM docker:1.12-rc-dind - -RUN apk update && apk upgrade && apk add --no-cache ca-certificates - -COPY entrypoint.sh /usr/local/bin/ -COPY chaos.sh /usr/local/bin/ - -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] - -# USAGE: Add a CMD to your own Dockerfile to use this (NOT an ENTRYPOINT, so that this is called) -# CMD ["./runner"] diff --git a/api/runner/dind/chaos/README.md b/api/runner/dind/chaos/README.md deleted file mode 100644 index 5a4270962..000000000 --- a/api/runner/dind/chaos/README.md +++ /dev/null @@ -1 +0,0 @@ -dind docker to periodically kill docker to test against diff --git a/api/runner/dind/chaos/chaos.sh b/api/runner/dind/chaos/chaos.sh deleted file mode 100755 index 84042c513..000000000 --- a/api/runner/dind/chaos/chaos.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -sleep 600 # 10 minutes - -for i in 1..1000; do - pkill -9 dockerd - pkill -9 docker-containerd - # remove pid file since we killed docker hard - rm /var/run/docker.pid - sleep 30 - docker daemon \ - --host=unix:///var/run/docker.sock \ - --host=tcp://0.0.0.0:2375 & - sleep 300 # 5 minutes -done diff --git a/api/runner/dind/chaos/entrypoint.sh b/api/runner/dind/chaos/entrypoint.sh deleted file mode 100755 index 26401dc45..000000000 --- a/api/runner/dind/chaos/entrypoint.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -set -ex - -# modified from: https://github.com/docker-library/docker/blob/866c3fbd87e8eeed524fdf19ba2d63288ad49cd2/1.11/dind/dockerd-entrypoint.sh -# this will run either overlay or aufs as the docker fs driver, if the OS has both, overlay is preferred. - -docker daemon \ - --host=unix:///var/run/docker.sock \ - --host=tcp://0.0.0.0:2375 & - -# wait for daemon to initialize -sleep 10 - -/usr/local/bin/chaos.sh & - -exec "$@" diff --git a/api/runner/dind/dind.sh b/api/runner/dind/dind.sh deleted file mode 100755 index 2c691fcd2..000000000 --- a/api/runner/dind/dind.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex -# modified from: https://github.com/docker-library/docker/blob/866c3fbd87e8eeed524fdf19ba2d63288ad49cd2/1.11/dind/dockerd-entrypoint.sh -# this will run either overlay or aufs as the docker fs driver, if the OS has both, overlay is preferred. -# rewrite overlay to use overlay2 (docker 1.12, linux >=4.x required), see https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#overlay-vs-overlay2 - -fsdriver=$(grep -Eh -w -m1 "overlay|aufs" /proc/filesystems | cut -f2) - -if [ $fsdriver == "overlay" ]; then - fsdriver="overlay2" -fi - -cmd="dockerd \ - --host=unix:///var/run/docker.sock \ - --host=tcp://0.0.0.0:2375 \ - --storage-driver=$fsdriver" - -# nanny and restart on crashes -until eval $cmd; do - echo "Docker crashed with exit code $?. Respawning.." >&2 - # if we just restart it won't work, so start it (it wedges up) and - # then kill the wedgie and restart it again and ta da... yea, seriously - pidfile=/var/run/docker/libcontainerd/docker-containerd.pid - kill -9 $(cat $pidfile) - rm $pidfile - sleep 1 -done diff --git a/api/runner/dind/entrypoint.sh b/api/runner/dind/entrypoint.sh deleted file mode 100755 index 3c719e11a..000000000 --- a/api/runner/dind/entrypoint.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh - -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -ex - -/usr/local/bin/dind.sh & - -# wait for daemon to initialize -sleep 3 - -exec "$@" diff --git a/api/runner/dind/release.sh b/api/runner/dind/release.sh deleted file mode 100755 index 7d8f8d0f8..000000000 --- a/api/runner/dind/release.sh +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright 2016 Iron.io -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -./build.sh - -docker run --rm -v "$PWD":/app treeder/bump patch -version=`cat VERSION` -echo "version $version" - -docker tag iron/dind:latest iron/dind:$version - -docker push iron/dind:latest -docker push iron/dind:$version diff --git a/api/version/version.go b/api/version/version.go index ff95fd831..11c963e6c 100644 --- a/api/version/version.go +++ b/api/version/version.go @@ -1,4 +1,4 @@ package version // Version of IronFunctions -var Version = "0.2.59" +var Version = "0.2.60" diff --git a/circle.yml b/circle.yml index 5a2f36061..6eaf54796 100644 --- a/circle.yml +++ b/circle.yml @@ -4,15 +4,15 @@ machine: GOPATH: $HOME/go GOROOT: $HOME/golang/go PATH: $GOROOT/bin:$GOPATH/bin:/$PATH - GH_IRON: $GOPATH/src/github.com/treeder + GH_OWNER: $GOPATH/src/github.com/treeder GO_PROJECT: ../go/src/github.com/treeder/$CIRCLE_PROJECT_REPONAME services: - docker checkout: post: - - mkdir -p "$GH_IRON" - - cp -R "$CHECKOUT_DIR" "$GH_IRON/$CIRCLE_PROJECT_REPONAME" + - mkdir -p "$GH_OWNER" + - cp -R "$CHECKOUT_DIR" "$GH_OWNER/$CIRCLE_PROJECT_REPONAME" dependencies: pre: @@ -41,7 +41,7 @@ deployment: branch: master owner: treeder commands: - - git config --global user.email "circleci@iron.io" + - git config --global user.email "treeder+circle@gmail.com" - git config --global user.name "CircleCI" - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - cd $GO_PROJECT && ./release.sh diff --git a/fn/install.sh b/fn/install.sh index ed13eb640..14ad3b907 100644 --- a/fn/install.sh +++ b/fn/install.sh @@ -3,7 +3,7 @@ set -e # Install script to install fn -release="0.2.59" +release="0.2.60" command_exists() { command -v "$@" > /dev/null 2>&1 diff --git a/release.sh b/release.sh index ef51e2314..c7bb0ffac 100755 --- a/release.sh +++ b/release.sh @@ -1,7 +1,7 @@ #!/bin/bash set -ex -user="iron" +user="treeder" service="functions" version_file="api/version/version.go" tag="latest"