Realize is the #1 Golang Task Runner which enhance your workflow by automating the most common tasks and using the best performing Golang live reloading.

Build status GoReport GoDoc License Gitter


#1 Golang live reload and task runner


Content

- ⭐️ Top Features

- 💃🏻 Get started

- 📄 Config sample

- 📚 Commands List

- 🛠 Support and Suggestions

- 😎 Backers and Sponsors

Top Features

  • High performance Live Reload.
  • Manage multiple projects at the same time.
  • Watch by custom extensions and paths.
  • All Go commands supported.
  • Switch between different Go builds.
  • Custom env variables for project.
  • Execute custom commands before and after a file changes or globally.
  • Export logs and errors to an external file.
  • Step-by-step project initialization.
  • Redesigned panel that displays build errors, console outputs and warnings.
  • Any suggestion? Suggest an amazing feature! 🕺🏻

Supporters


Quickstart

go get github.com/oxequa/realize

Commands List

Run Command

From project/projects root execute:

$ realize start

It will create a .realize.yaml file if doesn't already exist, add the working directory as project and run your workflow.

start command supports the following custom parameters:

--name="name"               -> Run by name on existing configuration
--path="realize/server"     -> Custom Path (if not specified takes the working directory name)
--generate                  -> Enable go generate
--fmt                       -> Enable go fmt
--test                      -> Enable go test
--vet                       -> Enable go vet
--install                   -> Enable go install
--build                     -> Enable go build
--run                       -> Enable go run
--server                    -> Enable the web server
--open                      -> Open web ui in default browser
--no-config                 -> Ignore an existing config / skip the creation of a new one

Some examples:

$ realize start
$ realize start --path="mypath"
$ realize start --name="realize" --build
$ realize start --path="realize" --run --no-config
$ realize start --install --test --fmt --no-config
$ realize start --path="/Users/username/go/src/github.com/oxequa/realize-examples/coin/"

If you want, you can specify additional arguments for your project:

✅ $ realize start --path="/print/printer" --run yourParams --yourFlags // right
❌ $ realize start yourParams --yourFlags --path="/print/printer" --run // wrong

⚠️ The additional arguments must go after the params:
💡 The start command can be used with a project from its working directory without make a config file (--no-config).

Add Command

Add a project to an existing config file or create a new one.

$ realize add

💡 add supports the same parameters as start command.

Init Command

This command allows you to create a custom configuration step-by-step.

$ realize init

💡 init is the only command that supports a complete customization of all supported options.

Remove Command

Remove a project by its name

$ realize remove --name="myname"

Color reference

💙 BLUE: Outputs of the project.
💔 RED: Errors.
💜 PURPLE: Times or changed files.
💚 GREEN: Successfully completed action.

Config sample

*** there is no more a .realize dir, but only a .realize.yaml file ***

For more examples check: Realize Examples

settings:
    legacy:
        force: true             // force polling watcher instead fsnotifiy
        interval: 100ms         // polling interval
    resources:                  // files names
        outputs: outputs.log
        logs: logs.log
        errors: errors.log
server:
    status: false               // server status
    open: false                 // open browser at start
    host: localhost             // server host
    port: 5001                  // server port
schema:
- name: coin
  path: coin              // project path
  env:            // env variables available at startup
        test: test
        myvar: value
  commands:               // go commands supported
    vet:
        status: true
    fmt:
        status: true
        args:
        - -s
        - -w
    test:
        status: true
        method: gb test    // support different build tools
    generate:
        status: true
    install:
        status: true
    build:
        status: false
        method: gb build    // support differents build tool
        args:               // additional params for the command
        - -race
    run:
        status: true
  args:                     // arguments to pass at the project
  - --myarg
  watcher:
      paths:                 // watched paths
      - /
      ignore_paths:          // ignored paths
      - vendor
      extensions:                  // watched extensions
      - go
      - html
      scripts:
      - type: before
        command: echo before global
        global: true
        output: true
      - type: before
        command: echo before change
        output: true
      - type: after
        command: echo after change
        output: true
      - type: after
        command: echo after global
        global: true
        output: true
      errorOutputPattern: mypattern   //custom error pattern

Support and Suggestions

💬 Chat with us Gitter
⭐️ Suggest a new Feature

Backers

Support us with a monthly donation and help us continue our activities. [Become a backer]

Sponsors

Become a sponsor and get your logo here! [Become a sponsor]

Comments
  • open /dev/null: too many open files

    open /dev/null: too many open files

    I get the error "open /dev/null: too many open files". I don't know what is the cause. In this moment, I'm using github.com/pilu/fresh and not happen this.

  • watch stops working after 1st save

    watch stops working after 1st save

    The watcher seems to stop working after the first time a file gets saved, until another file gets saved. The app doesn't crash or exit; and the watcher does continue running - but it won't restart/do-whatever-is-configured.

    Here's what happens exactly: say files A.go and B.go exist. Realize has started and completed a build for the first time. File A gets changed and saved, and realize detects its and runs a build. Another change is made to file A and saved - realize doesn't do anything. If you edit file B and save it, realize will detect and run a build. Now if you go back and change file A again and save it, realize runs again. So on and so forth.

    It feels like some kind of caching mechanism against the filename might be causing issues, but just a hunch.

    Let me know if any other system or config info would be helpful to figure this out.


    realize.yml file:

    settings:
      files:
        outputs:
          status: false
          path: ""
          name: .r.outputs.log
        logs:
          status: false
          path: ""
          name: .r.logs.log
        errors:
          status: false
          path: ""
          name: .r.errors.log
      legacy:
        force: false
        interval: 0s
    server:
      status: false
      open: false
      port: 5002
      host: 0.0.0.0
    schema:
    - name: appname
      path: .
      commands:
        fmt:
          status: true
        install:
          status: true
        run:
          status: true
      args:
      - service
      - run
      - --all
      watcher:
        extensions:
        - go
        paths:
        - /
        ignored_paths:
        - .git
        - .realize
        - vendor
    
  • Change import path of cli package

    Change import path of cli package

    Overview

    Issue is here.

    Modifications

    I changed import path of urfave/cli like below and fixed it.

    Before: "gopkg.in/urfave/cli.v2" After: "github.com/urfave/cli/v2"

    Test result

    $ go test ./...
    ok  	github.com/yyh-gl/realize	(cached)
    ok  	github.com/yyh-gl/realize/realize	0.385s
    
  • Doesn't work after second watch cycle

    Doesn't work after second watch cycle

    Hi, thanks for great extension, I was using it before 2.0 version and it was working fine, after switching to 2.0 version it seems that realize is broken.

    My project: /test/main.go

    package main
    
    import (
    	"fmt"
    )
    
    func main() {
    	fmt.Println("hello")
    }
    

    .realize.yaml

    settings:
      legacy:
        force: false
        interval: 0s
    server:
      status: false
      open: false
      port: 5002
      host: localhost
    schema:
    - name: test
      path: .
      commands:
        vet:
            status: true
        fmt:
            status: true
        run:
            status: true
      watcher:
        paths:
        - /
        extensions:
        - go
        ignored_paths:
        - .git
        - .realize
        - vendor
    

    When I run command realize start I get this output

    [09:50:01][TEST] : Watching 1 file/s 1 folder/s
    [09:50:01][TEST] : Install started
    [09:50:01][TEST] : Install completed in 0.245 s
    [09:50:01][TEST] : Running..
    [09:50:01][TEST] : hello
    

    after a change from hello to hello2 I get correct output

    [09:50:46][TEST] : GO changed /Users/me/go/src/github.com/anjmao/adify/test/main.go[09:50:46][TEST] : Install started
    [09:50:46][TEST] : Install completed in 0.258 s
    [09:50:46][TEST] : Running..
    [09:50:46][TEST] : hello2
    

    but after third change to hello3 I'm not getting any output anymore, it's seems that realize is stuck and not watching for changes.

    My environment: Go version: go version go1.9.2 darwin/amd64 OS: macOS High Sierra 10.12.2

  • print by log package is not displayed in terminal. It Is a behavior expected?

    print by log package is not displayed in terminal. It Is a behavior expected?

    
    import (
        "fmt"
        "log"
    )
    
    func main() {
        fmt.Println("IT IS DISPLAYED IN THE TERMINAL")
        log.Println("BUT IT IS NOT DISPLAYED IN THE TERMINAL")
    }
    
    
  • echo web framework not reloading

    echo web framework not reloading

    I'm using echo framework..

    package main
    
    import (
    	"net/http"
    
    	"github.com/labstack/echo"
    	_ "github.com/labstack/echo/middleware"
    )
    
    func main() {
    	e := echo.New()
    	e.GET("/", func(c echo.Context) error {
    		return c.String(http.StatusOK, "Hello, World!")
    	})
    	e.Logger.Fatal(e.Start(":1323"))
    }
    

    Use this code, I got this error on reload.

    {"time":"2018-02-07T21:15:39.0465869+09:00","level":"-","prefix":"echo","file":"server.go","line":"15","message":"listen tcp :1323: bind: Only one usage of each socket address (protocol/network address/port) is normally permitted."}

    and change code.. e.Logger.Fatal(e.Start(":1323")) to e.Start(":1323") I do not see the error message.. but, web browser data is not changed..

    This is my .realize.yaml file..

    settings:
      legacy:
        force: false
        interval: 0s
    server:
      status: false
      open: false
      port: 0
      host: ""
    schema:
    - name: goodSite
      path: .
      commands:
        fmt:
          status: true
        install:
          status: true
        run:
          status: true
      watcher:
        paths:
        - /
        extensions:
        - go
        ignored_paths:
        - .git
        - .realize
        - vendor
    

    Thank for your help..

  • Error Setting Rlimit  operation not permitted

    Error Setting Rlimit operation not permitted

    $ realize add
    Error Setting Rlimit  operation not permitted
    Realize - 1.1
    A Go build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths
    

    image

    $ realize run
    Error Setting Rlimit  operation not permitted
    Realize - 1.1
    A Go build system with file watchers, output streams and live reload. Run, build and watch file changes with custom paths
    

    image

    also empty window shown:

    image

    if i use --no-bin it shows something:

    image

    but it doesn't run normally like when using codegangsta/gin

    gin -i -b /tmp/gin-bin # to run it on RAM instead of disk
    

    image

  • realize: command not found

    realize: command not found

    I ran go get github.com/oxequa/realize. It successfully installed and tried to run realize start in my project directory.

    go1.10.1 linux/amd64

    Thanks Ahead For Any Help/Suggestions.

  • --run parameters do not work

    --run parameters do not work

    realize start --path="/print/printer" --run print/cmd/main.go --no-config

    This command still tries to execute main.go from the project root directory.

  • Can not recognize the default $GOPATH

    Can not recognize the default $GOPATH

    I'm using the GOPATH as default one of Go 1.9: ~/go. And all go commands is working correctly without any problems. But, when I run the realize start, the realize throws the $GOPATH isn't set properly error.

    It seems like that the realize can not recognize the default GOPATH. Is it a bug?

  • Only reloads once

    Only reloads once

    Hi!

    I'm on MacOS testing realize. It restarts the project fine on the first file change. After that is does not restart any more.

    Any ideas? Any infos you need?

  • Running go mod tidy

    Running go mod tidy

    In particular, this removes the line:

    github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA=
    

    which was causing problems when you do a go get

  • realize. file upload. No obvious error prompt

    realize. file upload. No obvious error prompt

    What version of Go are you using (go version)?

    $ go version
    go version go1.14.5 linux/amd64
    

    Does this issue reproduce with the latest release?

    Yes, There is still no solution

    What operating system and processor architecture are you using (go env)?

    go env Output
    $ go env
    GO111MODULE="on"
    GOARCH="amd64"
    GOBIN=""
    GOCACHE="/home/cloud/.cache/go-build"
    GOENV="/home/cloud/.config/go/env"
    GOEXE=""
    GOFLAGS=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOINSECURE=""
    GONOPROXY=""
    GONOSUMDB=""
    GOOS="linux"
    GOPATH="/home/cloud/work/golang"
    GOPRIVATE=""
    GOPROXY="https://goproxy.cn"
    GOROOT="/usr/local/share/go"
    GOSUMDB="sum.golang.org"
    GOTMPDIR=""
    GOTOOLDIR="/usr/local/share/go/pkg/tool/linux_amd64"
    GCCGO="gccgo"
    AR="ar"
    CC="gcc"
    CXX="g++"
    CGO_ENABLED="1"
    GOMOD="/dev/null"
    CGO_CFLAGS="-g -O2"
    CGO_CPPFLAGS=""
    CGO_CXXFLAGS="-g -O2"
    CGO_FFLAGS="-g -O2"
    CGO_LDFLAGS="-g -O2"
    PKG_CONFIG="pkg-config"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build788491564=/tmp/go-build -gno-record-gcc-switches"
    

    What did you do?

    I'm using the HTTP service. use gin https://github.com/gin-gonic/gin I found that it had nothing to do with gin

    I'm uploading a special file.

    func Upload(ctx *gin.Context)  {
    	file, err := ctx.FormFile("file")
    	if err != nil {
    		ctx.JSON(http.StatusOK, response.Error(err))
    		return
    	}
    	fmt.Println(file, err)
            ctx.JSON(http.StatusOK, response.Success("ok", nil))
    	return
    }
    

    he service didn't respond after I uploaded it.

    And the service seems to be all right, no error prompt, no crash error prompt, it seems to be all right!!!

    When I access this interface for the second time, return Error: connect ECONNREFUSED 127.0.0.1:8080

    At this time, golang still looks very healthy, but he can't work any more

    [09:51:43][EPDS] : [GIN-debug] DELETE /v1/field/testing/:id     --> epds/apis/v1/controllers.TestingFieldDelete (5 handlers)
    [09:51:43][EPDS] : [GIN-debug] Listening and serving HTTP on 0.0.0.0:8080
    

    Then I found out where the problem was.

    I debug the code.

                   // file, store in memory or on disk
    		fh := &FileHeader{
    			Filename: filename,
    			Header:   p.Header,
    		}
    		n, err := io.CopyN(&b, p, maxMemory+1)
    		fmt.Println(err, "eeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
    		if err != nil && err != io.EOF {
    			return nil, err
    		}
    		fmt.Println("qqqqqqqqqqqqqqqqqqqqq")
    		fmt.Println(b.Bytes(), "bbbbbbbbbbbbbbbbbbbbb")
    		fmt.Println("The process has collapsed")
    

    output

    [09:57:19][EPDS] : [GIN-debug] Listening and serving HTTP on 0.0.0.0:8080
    [09:57:32][EPDS] : EOF eeeeeeeeeeeeeeeeeeeeeeeeeeeeee
    [09:57:32][EPDS] : qqqqqqqqqqqqqqqqqqqqq
    

    The process has collapsed No output !!!!!!!!!!!!! io.EOF error. Can no longer call b.Bytes()

    Now I post my file fileName: test.yaml

    {{- $app_name := .Values.application.name -}}
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-config
    data:
      components.php: |
        <?php
    
        $db = require(__DIR__ . '/db.php');
    
        $components = [
    
            'request' => [
                // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
                'cookieValidationKey' => '3zX3FVJW7jtWMyNc8mHOIiZPzjwh-XIu1',
            ],
    
            'cache' => [
                'class' => 'yii\caching\FileCache',
            ],
    
            'user' => [
                'identityClass'   => 'app\models\User',
                'enableAutoLogin' => true,
            ],
    
            'errorHandler' => [
                'errorAction' => 'touch/errors/error',
            ],
    
            /*
            'log' => [
                'traceLevel' => YII_DEBUG ? 3 : 0,
                'targets' => [
                    [
                        'class'  => 'yii\log\FileTarget',
                        'levels' => ['error', 'warning'],
                    ],
                ],
            ],
            */
    
            'log' =>[
                'traceLevel' => YII_DEBUG ? 3 : 0,
                'targets' => [
                    'db' =>[
                        'class'   => 'yii\log\DbTarget',
                        'enabled' => true,
                        'prefix'  => function () {
                            return Yii::$app->user->id;
                        },
                        'categories' => ['admin', 'author'],
                        'levels'     => ['info'],
                        {{ $logTable := "{{%ts_log}}" }}
                        'logTable' => '{{$logTable}}',
                        'logVars'    => [],
                    ],
                ],
            ],
    
            'mailer' => [
                // send all mails to a file by default. You have to set
                // 'useFileTransport' to false and configure a transport
                // for the mailer to send real emails.
                //'useFileTransport' => true,
                'class'            => 'yii\swiftmailer\Mailer',
                'viewPath'         => 'mail',
                'useFileTransport' => false,
                'transport' => [
                    'class'      => 'fdsfsf',
                    'host'       => 'gsdgsg',
                    'port'       => 'gds',
                    'encryption' => 'gsdgsd',
                    'username'   => '[email protected]',
                    'password'   => "dgsgsgsdgs",
                ],
            ],
    
            'urlManager' => [
                'enablePrettyUrl' => true,
                'showScriptName'  => false,
                'rules'           => [],
            ],
    
            'redis' => [
                'class'    => 'yii\redis\Connection',
                'hostname' => '{{.Values.redis.session.host}}',
                'port' => {{.Values.redis.session.port}},
                'database' => {{.Values.redis.session.database}},
                'password' => '{{.Values.redis.session.password}}'
            ],
            'redis2' => [
                'class'    => 'yii\redis\Connection',
                'hostname' => '{{.Values.redis.session.host}}',
                'port' => {{.Values.redis.session.port}},
                'database' => {{.Values.redis.session.database}},
                'password' => '{{.Values.redis.session.password}}'
            ],
    
            'script_authorize_redis_lock' => [
                'class'    => 'yii\redis\Connection',
                'hostname' => '{{.Values.redis.dan.host}}',
                'port' => {{.Values.redis.dan.port}},
                'database' => {{.Values.redis.dan.database}},
                'password' => '{{.Values.redis.dan.password}}',
            ],
    
            'session' => [
                'class'      => 'yii\redis\Session',
                'useCookies' => true,
                'timeout' => defined('SESSIONID_LIFE_TIME') ? constant('SESSIONID_LIFE_TIME') : 86400,       // session 过期时间
                'redis' => [
                  'hostname' => '{{.Values.redis.session.host}}',
                  'port' => {{.Values.redis.session.port}},
                  'database' => {{.Values.redis.session.database}},
                  'password' => '{{.Values.redis.session.password}}'
                ],
            ],
    
            'aliyunoss' => [
                'class'  => 'app\components\Aliyunoss',
                'config' => $params['oss'],
            ],
    
            'elasticsearch' => [
                'class'  => 'app\components\Elasticsearch',
                'config' => $params['elasticsearch']
            ],
    
            'version_upload_log' => [
                'class' => 'app\components\Logger',
                'logFile' => '@runtime/script_upload/'.date('Y-m-d').'.log',
            ],
        ];
        return array_merge($components, $db);
    
      console.php: |
        <?php
    
        $params = require(__DIR__ . '/params.php');
        $db = require(__DIR__ . '/db.php');
        $components = require(__DIR__ . '/components.php');
        unset($components['request']);
        unset($components['errorHandler']);
        unset($components['mailer']);
        unset($components['user']);
    
        $config = [
            'id' => 'basic-console',
            'basePath' => dirname(__DIR__),
            'bootstrap' => ['log'],
            'controllerNamespace' => 'app\commands',
    
            /*
            'components' => [
                'cache' => [
                    'class' => 'yii\caching\FileCache',
                ],
                'log' => [
                    'targets' => [
                        [
                            'class' => 'yii\log\FileTarget',
                            'levels' => ['error', 'warning'],
                        ],
                    ],
                ],
                'db' => $db,
            ],
            'params' => $params,
            */
    
            'components'   => $components,
            'params'       => $params,
    
            /*
            'controllerMap' => [
                'fixture' => [ // Fixture generation command line.
                    'class' => 'yii\faker\FixtureController',
                ],
            ],
            */
        ];
    
        if (YII_ENV_DEV) {
            // configuration adjustments for 'dev' environment
            $config['bootstrap'][] = 'gii';
            $config['modules']['gii'] = [
                'class' => 'yii\gii\Module',
            ];
        }
        return $config;
    
      db.php: |
        <?php
    
        return [
            // 触动DB
            'db' => [
                'class'    => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.main_rw_splitting.host}};dbname={{.Values.mysql.main_rw_splitting.dbname}}',
                'username' => '{{.Values.mysql.main_rw_splitting.user}}',
                'password' => '{{.Values.mysql.main_rw_splitting.password}}',
                'charset'  => 'utf8mb4',
                'attributes' => [
                    PDO::MYSQL_ATTR_FOUND_ROWS => true,
                ],
            ],
    
            'db_pay' => [
                'class'    => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.ts_pay.host}};dbname={{.Values.mysql.ts_pay.dbname}}',
                'username' => '{{.Values.mysql.ts_pay.user}}',
                'password' => '{{.Values.mysql.ts_pay.password}}',
                'charset'  => 'utf8'
            ],
    
            'db_elf' => [
                'class'    => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.elf.host}};dbname={{.Values.mysql.elf.dbname}}',
                'username' => '{{.Values.mysql.elf.user}}',
                'password' => '{{.Values.mysql.elf.password}}',
                'charset'  => 'utf8'
            ],
    
            'db_ent' => [
                'class'    => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.enterprise.host}};dbname={{.Values.mysql.enterprise.dbname}}',
                'username' => '{{.Values.mysql.enterprise.user}}',
                'password' => '{{.Values.mysql.enterprise.password}}',
                'charset'  => 'utf8'
            ],
    
            'db_pro' => [
                'class' => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.tspro.host}};dbname={{.Values.mysql.tspro.dbname}}',
                'username' => '{{.Values.mysql.tspro.user}}',
                'password' => '{{.Values.mysql.tspro.password}}',
                'charset' => 'utf8',
            ],
    
            'db_statis' => [
                'class' => 'yii\db\Connection',
                'dsn' => 'mysql:host={{.Values.mysql.ts_statis.host}};dbname={{.Values.mysql.ts_statis.dbname}}',
                'username' => '{{.Values.mysql.ts_statis.user}}',
                'password' => '{{.Values.mysql.ts_statis.password}}',
                'charset' => 'utf8',
            ],
        ];
    
      params.php: |
        <?php
    
        return [
    
            'loginUrl' => 'fsdfsdf',
    
            'oss' => [
                'OSS_ACCESS_ID'=>'{{.Values.ram.author_platform.access_id}}',
                'OSS_ACCESS_KEY'=>'{{.Values.ram.author_platform.access_key}}',
                'EndPoint'=>'http://fsdfsdf',
                'OSS_BUCKETNAME'=>'fsdfsd',
                'root'=>'fsdf',
                'auth_photo_root' => 'fdsfsf',
            ],
    
            'ts-source-bucket'=>'fsdfsdfs-fsd',
    
            'cdn' => [
                'tsp'=>"https://{{.fdsp}}",
                'update'=>"https://{{.fsd.fsd.fds.fsdf}}",
                'oss'=>"https://{{.fsd.fs.ds.oss}}",
            ],
    
            'RSA_private_key' => file_get_contents( __DIR__ . '/secret/RsaPrivateKey.pem' ),
            'RSA_public_key'  => file_get_contents( __DIR__ . '/secret/RsaPublicKey.pem' ),
    
            'TSP_private_key' => file_get_contents( __DIR__ . '/secret/TspPrivateKey.pem' ),
    
            'card_auth_device_max_year' => 3,
    
            'card_day_consume' => 1,
    
            'buy_point_unit_price' => 0.05,
    
            'card_forever_consume' => 1000,
    
            'elasticsearch' => [
                'host' => [
                    'fsdfs.fdsfsdf.54.17:fds'
                ]
            ],
    
    
            'devices_list_es_search' => false,
            'system_upgrade' => false,
    
        ];
    
      web.php: |
        <?php
    
        $params = require(__DIR__ . '/params.php');
        $db = require(__DIR__ . '/db.php');
        $components = require(__DIR__ . '/components.php');
    
        $config = [
            'id'           => 'tsp',
            'basePath'     => dirname(__DIR__),
            'bootstrap'    => ['log'],
            'language'     => 'zh-CN',
            'components'   => $components,
            'params'       => $params,
        ];
    
        if (YII_ENV_DEV) {
            // configuration adjustments for 'dev' environment
            $config['bootstrap'][] = 'debug';
            $config['modules']['debug'] = [
                'class' => 'yii\debug\Module',
                // uncomment the following to add your IP if you are not connecting from localhost.
                'allowedIPs' => ['115.171.135.157'],
            ];
    
            $config['bootstrap'][] = 'gii';
            $config['modules']['gii'] = [
                'class' => 'yii\gii\Module',
                // uncomment the following to add your IP if you are not connecting from localhost.
            ];
        }
    
        return $config;
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-nginx
    data:
      nginx.conf: |
        limit_req_zone $binary_remote_addr zone=addr:10m rate=1000r/s;
        server {
            client_max_body_size 50m;
            listen 80;
    
            proxy_ignore_client_abort on;
            client_header_timeout 300s;
            client_body_timeout   300s;
    
            #server_name localhost dev.touchsprite.com;
            server_name  {{ template "nginx.servername" . }};
        	#limit_req   zone=req_one  burst=100;
            limit_req zone=addr burst=5000 nodelay;
    
            root /www/default/web;
            index index.php index.html index.htm;
    
    
            location /static/ {
                access_log off;
                expires 1d;
                root "/www/default/web/frontEnd/dist";
            }
    
            location /new_public/ {
               access_log off;
               expires 1d;
               root "/www/default/web/frontEnd";
            }
    
            location / {
                try_files $uri $uri/ /index.php?$args;
            }
    
            location = /s-c-data {
              # 允许跨域
              add_header Access-Control-Allow-Origin *;
              add_header Access-Control-Allow-Headers X-Requested-With;
              add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
              default_type text/html;
              return 200 $msec;
            }
    
            location /ajax/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /site/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /images/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /css/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /js/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /assets/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /script/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
            location /public/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /key/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /category/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /blacklist/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /device/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /temporary/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /log/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /about/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /weixin/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /openapi/luacts1 {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location /weixinqa/ {
                proxy_connect_timeout 300s;
                proxy_send_timeout 300s;
                proxy_read_timeout 300s;
                proxy_pass http://svc-tsstore-web-http;
            }
    
            location ~ \.php$ {
                include fastcgi.conf;
                fastcgi_connect_timeout 300s;
                fastcgi_send_timeout 300s;
                fastcgi_read_timeout 300s;
                fastcgi_pass  unix:/var/run/php-fpm.sock;
                #fastcgi_pass   localhost:9000;
                #fastcgi_pass unix:/var/run/php5-fpm.sock;
                try_files $uri =404;
            }
        }
    
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-web
    data:
      index.php: |
        <?php
    
        define("SESSIONID_LIFE_TIME", 86400);
        ini_set('session.cookie_lifetime', SESSIONID_LIFE_TIME);
    
        $host = $_SERVER['HTTP_HOST'];
        $suffix = substr($host, strrpos($host, '.'));
    
        ini_set('session.cookie_domain', "touchsprite{$suffix}");
    
        // comment out the following two lines when deployed to production
        {{- if .Values.debug }}
        defined('YII_DEBUG') or define('YII_DEBUG', true);
        defined('YII_ENV') or define('YII_ENV', 'dev');
        {{- else }}
        defined('YII_DEBUG') or define('YII_DEBUG', false);
        defined('YII_ENV') or define('YII_ENV', 'dev');
        {{- end }}
    
    
        require(__DIR__ . '/../vendor/autoload.php');
        require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php');
    
        $config = require(__DIR__ . '/../config/web.php');
    
        (new yii\web\Application($config))->run();
    
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-supervisor
    data:
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-root
    data:
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-secret
    data:
      TspPrivateKey.pem: |
        -----BEGIN RSA PRIVATE KEY-----
        MIIEpQIBAAKCAQEAzwyG5Ag2AnoAab+87ZJS/h7Jh4ZyIgH3JTbQTW1nsxuP/dNp
        a0uHqNkFjgN6QETVin3WTP/nTQt0PqKlJn9Tb8O8R+0iP1pGtacENd8iiUoNc1ts
        8Pu29IyFrQTnT+CG2eb4EVVNSwYXKyQeQirLohNDE5ld+dnjQlMDcKZCdlveb6T7
        22qJ6pYSvxi7D5yVCdaAmHCXzNEWpYizon5dxDJlhXZsyTPJmkvYWaxkhK0oIU4S
        b/cJBLgBT9VmQGLuCNK3UzZmR7rzoHj70aVDc9nKSUu7RD9chYWJaz61dehfgG8e
        NF6kOSnW83J+4dPi6miEsGcN/5PTM+MX/ddmiQIDAQABAoIBADFM5U2k2t9qF3EW
        s7DJ97MEt63qiICqgSO+UoktNNUEChxBW8etm2bMDjOLhm+JNGOepQl+oZ/Jy2si
        pTpudPqW290wjMgTAeU9GJaPRBT2qg8+xMj41s6SKz5QfZeaeeGmyoiuDBKCJ8Ah
        AId20zgLaBxhl2vnwuJHC/mlzQuLVLvbC7g+S02e8WY4h4eBZ1iBQmL7D0pzyQ+j
        aiGlZvVJ+VBPXHpqHv+HM1wjqYmQAH2TfNJdSDOwuQCNpishBBV8yCPk6BrHZpAH
        xkTbrnGmBFOl6HqGfFaGKxaxl7v58jBckQVoVckqEm+pZmC9WGhu2rVZ/MZOSNQm
        bkkExVECgYEA8gEDF9asDanYQYcaNzI4fVzxWSR1xBTFiQGUGWhKC+u/RX2dT7gG
        rITy2jKtzZn74EKU5Ope65ISkw4Mo7Ha7RwFsDhv+QXel+CX2r6+8r7PfQ5CcGuj
        UldBXTHu2tmMRq3HORRIrpVbXa0qw0G9jt9Fcdw7pynvSdvnsPXBbX0CgYEA2wX9
        D2vh0BFC6SJwb30+DT5IX5ITXUybiBJ8C7+7eHfK5fwwgaZae6n5QUra/vhQ8yDz
        YFBshIVZYdV3vYH2RkbuoZy35Finyoq0jUmHdOQl2Ji4rRark9nvsYAWnCGXCZPc
        jH1TcToYVejjpTa9Jfcq9kfc0dbr3PxSs+Xlmv0CgYEAoye7hh7c8HlJqyQCsKPT
        IfG/ZXIHU6MNakj+KAL/qPnPgnIl1NEk7rrTX/g65RqjjZZV+99nDzrz+uDF9La7
        +o+h5iSmmSUz5QEuX/OpmM675Hvwnwpymdjp4IMBndp9kEkov3rFZa6cYpOU+P8h
        ZWlx0EnCjfjfstPnaI7HUaECgYEA1SNewEMb3H7vvi/leplGaVzS0S416fVC5YgX
        bteGeBUbPfPMwF5Cb1VZWlCeDMFZBUBrlq6s68lY0fwKKkDuiDU+w8berTgZEOEq
        EtQbHYVnzv/Pt6D4F0leGD2twwJtGMTrOfff0w6h1UhmXipD33VU7zT8ha8rPeZT9O8
        J5Txe4ECgYEA3yVm5TvZpi7GWtjklFGX+/4kISL8MkkvS7BhStk1y/F5Aj4F+/LI
        GbKzsC78vYhsqBhP+jNCWgKGSjEOBFsjMl7SnpU7zQ6wO+N5N4jDeOlDS7YbafCC
        mHVO5XDmVw93opRVsm8Fns6s0NhDQP4rzO1bODUFxZH1QNMZ4Hle7tw=
        -----END RSA PRIVATE KEY-----
    
      RsaPrivateKey.pem: |
        -----BEGIN RSA PRIVATE KEY-----
        MIICXAIBAAKBgQCh1l7EsjADCC2sSBFun7SbAftCnufCklS9OsFE6U4PY/M/dE8q
        LAP36SUkS28CesC7DBN7kka7F+LQHiO2KmxQi8YcayKZ5IPGvNhoh0gCdTnvXRE9
        FSmP42KiDbnJOGWQO86Y1LpQY74MJvYsnxBNYURc719A/ZRuV9uPJSZXHwIDAQAB
        AoGAL03NnYjH59r4HqdiEQe1bqmBm9N+wqyrADSwUUgwfOcmLqH8kcMT1d7b8GPs
        KrlepE2/VBtJeV5d+Z8VqSV1Sw7Rmkpn2nMeQ1rhavkipnB3tanEYwFgpI9TFg+F
        GRINrrREbvsYMVSe44G0BxB3LcgdLcfsssdi6QLWzXMEoddFdrAECQQDM4CQWVceK8XTS
        w6Bx6eQJAUZr7vK5YdnrZxGQ0Q85HMlD7uPeFCbwkPYGUKHiNj9vCyzJ3iPz3v5P
        1Ncg5n+fAkEAyjjdfw4Ub188kfnC+JYzHzdZODPrqiatCsAaXoEDq7Iul9NDAH75
        HW4WR6z2SMTozcfIaqz7QSQ4AK/CheL4gQJAENpTPZ8axfwsvvWmqhgyUOdQ8qn6
        P3OkKHAXCtGXrfwHNlZdWjRQK7PQ+R4C4wfRWgISUhy62mG6i7iXZbZwQwJBALZ6
        +A1GJFSX6S2E51axGzKpHH6mA5xISFByJ5lt7GUMZhUlU8nnyl6vT7WgM6JY5geD
        p6vzqssOpuafs/ZjaYECQEzevhkcJUzSBOTU8y46fx9vBcMbxFC8wAXn0rnIfUB5
        bl2s/46Qxw6KS0+ZD6XXSFfgxi7Rj9nP9Kq0YhZ65d0=
        -----END RSA PRIVATE KEY-----
    
      RsaPublicKey.pem: |
        -----BEGIN PUBLIC KEY-----
        MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCh1l7EsjADCC2sSBFun7SbAftC
        nufCklS9OsFE6U4PY/M/dE8qLAP36fffSUkS28CesC7DBN7kka7F+LQHiO2KmxQi8Yc
        ayKZ5IPGvNhoh0gCdTnvXRE9FSmP42KiDbnJOGWQO86Y1LpQY74MJvYsnxBNYURc
        719A/ZRuV9uPJSZXHwIDAQAB
        -----END PUBLIC KEY-----
    
    
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cm-{{$app_name}}-fpm
    data:
      zzz-docker.conf: |
        [global]
        daemonize = no
    
        [www]
        listen = /var/run/php-fpm.sock
        listen.mode = 0777
    

    What did you expect to see?

    I need information remind To help me

    What did you see instead?

    I didn't see any information

    I used it https://github.com/oxequa/realize

    That's the problem I tried

    go run
    
    go build -o epds
    ./epds -c config.yaml
    

    The above operation will not be a problem The key is that the above documents are special I didn't find any problems with other documents

    use https://github.com/oxequa/realize Problems encountered

    .realize.yaml

    settings:
      legacy:
        force: false
        interval: 0s
    
    server:
      status: true
      open: true
      port: 10086
      host: 127.0.0.1
    schema:
    - name: epds
      path: .
      commands:
        build:
          status: true
          method: go build
          args:
            - -o ./bin/epds
        run:
          status: true
          method: ./bin/epds
      args:
        - -c=./config/config.yaml
      watcher:
        extensions:
        - go
        paths:
        - /
        ignored_paths:
        - .git
        - .realize
        - vendor
    
  • go: github.com/oxequa/realize imports 	gopkg.in/urfave/cli.v2: gopkg.in/urfave/cli.v2@v2.2.0: parsing go.mod: 	module declares its path as: github.com/urfave/cli/v2 	        but was required as: gopkg.in/urfave/cli.v2

    go: github.com/oxequa/realize imports gopkg.in/urfave/cli.v2: gopkg.in/urfave/[email protected]: parsing go.mod: module declares its path as: github.com/urfave/cli/v2 but was required as: gopkg.in/urfave/cli.v2

    image

    ➜ go go get github.com/oxequa/realize go: github.com/oxequa/realize upgrade => v2.0.2+incompatible go: finding module for package github.com/oxequa/interact go: finding module for package gopkg.in/urfave/cli.v2 go: finding module for package gopkg.in/yaml.v2 go: finding module for package github.com/go-siris/siris/core/errors go: finding module for package github.com/labstack/echo go: finding module for package github.com/fsnotify/fsnotify go: finding module for package github.com/fatih/color go: finding module for package github.com/sirupsen/logrus go: finding module for package github.com/labstack/echo/middleware go: finding module for package golang.org/x/net/websocket go: found github.com/oxequa/interact in github.com/oxequa/interact v0.0.0-20171114182912-f8fb5795b5d7 go: found gopkg.in/urfave/cli.v2 in gopkg.in/urfave/cli.v2 v2.2.0 go: found github.com/fatih/color in github.com/fatih/color v1.9.0 go: found github.com/fsnotify/fsnotify in github.com/fsnotify/fsnotify v1.4.9 go: found github.com/go-siris/siris/core/errors in github.com/go-siris/siris v7.4.0+incompatible go: found github.com/labstack/echo in github.com/labstack/echo v3.3.10+incompatible go: found github.com/sirupsen/logrus in github.com/sirupsen/logrus v1.6.0 go: found golang.org/x/net/websocket in golang.org/x/net v0.0.0-20200625001655-4c5254603344 go: found gopkg.in/yaml.v2 in gopkg.in/yaml.v2 v2.3.0 go: github.com/oxequa/realize imports gopkg.in/urfave/cli.v2: gopkg.in/urfave/[email protected]: parsing go.mod: module declares its path as: github.com/urfave/cli/v2 but was required as: gopkg.in/urfave/cli.v2

  • fix: add os.environ when using env from yaml

    fix: add os.environ when using env from yaml

    Pull request #203 introduced the ignoring of the OS environment which has already been noted by #258. This hopefully solves the problem by filling the env slice with the OS environment if no yaml env configuration for a key exist.

  • Panic in run phase

    Panic in run phase

    When I run realize from inside docker, there is no panic. Panics when running from outside. Same realize version in both environments.

    panic: runtime error: invalid memory address or nil pointer dereference
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10be1de]
    
    goroutine 387 [running]:
    os.(*Process).signal(0x0, 0x1654d80, 0x19a5830, 0x0, 0x0)
            /usr/local/go/src/os/exec_unix.go:56 +0x2e
    os.(*Process).Signal(...)
            /usr/local/go/src/os/exec.go:131
    github.com/oxequa/realize/realize.(*Project).run.func1(0xc0000c36a8)
            /Users/prats/workspace/src/github.com/oxequa/realize/realize/projects.go:581 +0x5d
    github.com/oxequa/realize/realize.(*Project).run(0xc000128e00, 0xc000024e80, 0x13, 0xc000408d80, 0xc00019c000, 0x16504c0, 0xc00014e000)
            /Users/prats/workspace/src/github.com/oxequa/realize/realize/projects.go:646 +0xc5b
    github.com/oxequa/realize/realize.(*Project).Reload.func3(0xc000128e00, 0xc000408d80, 0xc00019c000)
            /Users/prats/workspace/src/github.com/oxequa/realize/realize/projects.go:262 +0x147
    created by github.com/oxequa/realize/realize.(*Project).Reload
            /Users/prats/workspace/src/github.com/oxequa/realize/realize/projects.go:260 +0x297
    

    Realize version 2.0.3 go version go1.12.7 linux/amd64 (Inside docker) go version go1.12.6 darwin/amd64 (outside)

    yaml file:

    settings:
      legacy:
        force: false
        interval: 0s
      schema:
      - name: test
        path: .
        commands:
          build:
            status: true
            method: go build -i -o test .
          run:
            status: true
            method: test
    
Build system and task runner for Go projects
Build system and task runner for Go projects

Gilbert is task runner that aims to provide declarative way to define and run tasks like in other projects like Gradle, Maven and etc.

Dec 21, 2022
Eget is the best way to easily get pre-built binaries for your favorite tools.
Eget is the best way to easily get pre-built binaries for your favorite tools.

Eget: easy pre-built binary installation Eget is the best way to easily get pre-built binaries for your favorite tools. It downloads and extracts pre-

Dec 27, 2022
Moldy CLI the best project starter and manager of the world
Moldy CLI the best project starter and manager of the world

Moldy The best project starter of the world ?? What is Moldy ? Hey I present Moldy this beautiful tool that will solve your life in creating, managing

Oct 17, 2022
Live reload utility for Go web servers

gin gin is a simple command line utility for live-reloading Go web applications. Just run gin in your app directory and your web app will be served wi

Jan 4, 2023
☁️ Live reload for Go apps
☁️ Live reload for Go apps

Air ☁️ Live reload for Go apps Motivation When I get started with developing websites in Go and gin framework, it's a pity that gin lacks live-reloadi

Jan 1, 2023
A small utility that aims to automate and simplify some tasks related to software release cycles.

Stork is a small utility that aims to automate and simplify some tasks related to software release cycles such as reading the current version from a f

Nov 9, 2022
run/stop goroutines/tasks securely, recursively

grunner - run/stop goroutines/tasks securely, recursively. s1 := grunner.New() s1.Defer(func() { fmt.Println("s1 stopped 2") }) s1.Defer(func() {

Apr 22, 2022
🚀 gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file.
🚀 gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file.

gowatch 中文文档 gowatch is a command line tool that builds and (re)starts your go project everytime you save a Go or template file. Installation To insta

Dec 30, 2022
Golang binaries compiled on-demand for your system
Golang binaries compiled on-demand for your system

Go Binaries Go Binaries is an on-demand binary server, allowing non-Go users to quickly install tools written in Go without installing go itself, and

Dec 3, 2022
a Make/rake-like dev tool using Go
a Make/rake-like dev tool using Go

About Mage is a make-like build tool using Go. You write plain-old go functions, and Mage automatically uses them as Makefile-like runnable targets. I

Jan 7, 2023
Monitoring changes in the source file and automatically compile and run (restart).
Monitoring changes in the source file and automatically compile and run (restart).

dogo Monitoring changes in the source file and automatically compile and run (restart). 中文 Install go get github.com/liudng/dogo Create config Here's

Dec 28, 2022
Various tools for usage with Golang like installer, github tool and cloud features.

Gopei2 (Go Programming Environment Installer) Gopei shell install Go compiler, LiteIDE and configure for you the entire environment, variables, paths,

Dec 23, 2022
packM 🧬 is fivem resource compiler for golang with the power of golang+typescript+webpack

packM ?? packM ?? is fivem resource compiler for golang ,typescript with the power of golang+typescript compiler+webpack

Jun 28, 2022
Builds and restarts a Go project when it crashes or some watched file changes
Builds and restarts a Go project when it crashes or some watched file changes

gaper Used to build and restart a Go project when it crashes or some watched file changes Aimed to be used in development only. Changelog See Releases

Dec 30, 2022
a build tool for Go, with a focus on cross-compiling, packaging and deployment

goxc NOTE: goxc has long been in maintenance mode. Ever since Go1.5 supported simple cross-compilation, this tool lost much of its value. There are st

Dec 9, 2022
An extremely fast JavaScript bundler and minifier
An extremely fast JavaScript bundler and minifier

An extremely fast JavaScript bundler and minifier

Jan 4, 2023
GoReleaser builds Go binaries as fast and easily as possible
GoReleaser builds  Go binaries as fast and easily as possible

GoReleaser builds Go binaries for several platforms, creates a GitHub release and then pushes a Homebrew formula to a tap repository. All that wrapped in your favorite CI.

Jan 7, 2023
Build and (re)start go web apps after saving/creating/deleting source files.

unmaintained Fresh Fresh is a command line tool that builds and (re)starts your web application everytime you save a Go or template file. If the web f

Jan 2, 2023
NFPM is Not FPM - a simple deb, rpm and apk packager written in Go

NFPM NFPM is Not FPM - a simple deb, rpm and apk packager written in Go. Why While fpm is great, for me, it is a bummer that it depends on ruby, tar a

Jan 1, 2023