Skip to content
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

Revel 1.0.0 Upgrade Guide and Guidance for Existing apps #1501

Open
eparziale opened this issue Jul 13, 2020 · 19 comments
Open

Revel 1.0.0 Upgrade Guide and Guidance for Existing apps #1501

eparziale opened this issue Jul 13, 2020 · 19 comments
Assignees
Labels
priority-must now, top priority

Comments

@eparziale
Copy link

Hi Revel Team,

My team has used revel for the past 2 years and been very happy with the framework.

We have a website built on revel that attracts more than 20k users per month, and we're very pleased with performance, maintainability, ease of development, etc.

Last year we adjusted our app to use dep for dependency management, per the recommendations in the following two revel discussions:
revel/cmd#177
#1326

We were happily chugging along with development until this past weekend when Revel v1.0.0 was released. Our dep build process is no longer compatible with the latest version of revel, we need to adjust our builds to work again. We're seeking guidance in how to proceed (Either to upgrade our build process to use go mods and latest revel version, or how to use legacy revel cmd and framework to maintain existing functionality)

It seems there were some major changes in the 1.0.0 release that fundamentally changed the way that Revel can be included as a dependency, and how the revel cmd is used to start apps.

i.e. the revel run command now requires a -a flag for application path, and a -m flag for run mode.

In the past, we just ran our app by invoking revel run <appname> prod.

We're really excited about the update, and we're glad that Revel officially supports go modules now.

However, for teams with existing prod applications, do you have an official upgrade guide for the new revel version? i.e. a doc with general upgrade steps and common issues? We would love to get our application builds fixed so that we can continue development.

Also, is it possible for teams to use the legacy version of revel and revel cmd in the interim? If so, can you please share steps to do that?

Thanks very much.

@eparziale
Copy link
Author

Right now I'm creating a sample application to familiarize myself with the updated revel version, but running into some issues..

An example issue:

I'm on a machine with go v 1.14

After creating a sample app with the command revel new -a revel-test-app
When I run revel run -a revel-test-app -m dev the server boots fine.

But when I go to the test runner page, I'm unable to run the sample test suite (See screenshot)
image

Why do the tests not run out of the box? Am I doing something wrong with the skeleton project? My team has ~70 revel integration tests that we want to keep and port to the new version.

Thanks

@djvt
Copy link

djvt commented Jul 14, 2020

this is a critical issue for our team and users. any other revel users experiencing this problem after the update?

@notzippy
Copy link
Collaborator

Hi guys,

Sorry you are seeing these issues, it was a complicated process to change to use the new dependency model with Go and some things may have been overlooked. To use an older version of revel with go.mod tools it is pretty easy.

in an empty folder

$ mkdir gopath && export GOPATH=$PWD/gopath && go mod init test.com
$ go get -v github.com/revel/cmd/revel@v0.21.1
$ gopath/bin/revel version
Revel executing: displays the Revel Framework and Go version
WARN  22:01:33 version.go:71: Unable to extract version information from Revel error,err=nil LOG15_ERROR="Normalized odd number of arguments by adding nil" 
WARN  22:01:34 version.go:71: Unable to extract version information from Revel Modules error="open /home/notzippy/Downloads/temp/test/test3/gopath/pkg/mod/github.github.com/revel/modules/version.go: no such file or directory" 
Revel Framework :       Unknown (1.0.0 remote master branch)
Revel Cmd       :       0.21.1  (1.0.0 remote master branch)
Revel Modules   :       Unknown (1.0.0 remote master branch)

There appears to be a bug with the mode flag, I'm working on a unit test to check it and verify the fix as we speak. The command line syntax accepts both flagged and non flagged data, but there are assumptions made on order, so it is recommended you use flagged parameters.

ill be on https://gitter.im/revel/community to support you as much as I can over the next few days, there are others there who can be of help too.

@notzippy
Copy link
Collaborator

Mode flag issue revel/cmd#189

@notzippy
Copy link
Collaborator

Unit test issue revel/modules#104

@notzippy
Copy link
Collaborator

Unit test issue moved to revel/cmd#191

@notzippy
Copy link
Collaborator

@eparziale new revel/cmd v1.0.1 has been merged and tagged which should fix the issues with not finding tests and the revel run command. Let us know if you have identified further issues.

@eparziale
Copy link
Author

@notzippy Thanks for fixing the test flag!

We were able to adjust our code to build using all of the latest Revel Gear.

Here were the keys:

  1. Make sure we uninstalled previous version of Go (1.12 ) entirely from our our machines
  2. clean Install latest go version (1.14) on machines
  3. Follow the guide here to migrate from dep to go modules https://blog.callr.tech/migrating-from-dep-to-go-1.11-modules/ (Pretty straightforward)
  4. Increment all revel dependency versions in go.mod to latest version
  5. cd into our project folder and run go get github.com/revel/cmd/revel
  6. run revel build -a /go/src/[proj folder]
  7. cd to project dir and run -> go build ./... (Note revel build needs to run before this in order to build routes.go file)
  8. cd out of project dir (now I'm in /go/src). run -> revel run [project] [env]

All set!

One extra helpful note:

If you depend on private repos, need to run go env -w GOPRIVATE=github.com/[repo]


@notzippy One issue we observed:

When we run revel test [project] dev, that command can be run from any directory and it will dynamically find the project. i.e. I dont need to pass -a flag with absolute path.

However, revel run dev will only work if we are in parent dir of [proj]. i.e. if I have dir structure /go/src/[proj], I can run revel run [proj] dev when I am in /go/src dir.

However, if I am in another dir I need to run revel run -a /abs/path/to/[proj] dev in order to properly find the app.

See screenshot:
image

Can you please make this behavior consistent between the test and the run commands?

Thanks,

@notzippy
Copy link
Collaborator

@eparziale that is great news, I'm sorry about the dependency manager switch, but there was a high demand for being able to use Revel outside of the GOPATH and supporting multiple dependency managers got very complicated so we had to make a choice.

Another helpful idea is that revel supports multiple --gomod-flags from the command line, you can use that to modify your go.mod file dynamically to point to a specific path where files are checked out, these flags are run before the application is built (in the folder where the go.mod exists). See https://golang.org/cmd/go/#hdr-Module_maintenance (this is what I do on travis builds https://github.com/revel/cmd/blob/master/.travis.yml).

revel new     --gomod-flags "edit -replace=github.com/revel/revel=github.com/revel/revel@$REVEL_BRANCH" -a my/testapp2 

Tracking your new issue here: revel/cmd#193 , I know the code behaves a bit different if the path is an absolute path VS a relative path, perhaps that can be eliminated now.

@eparziale
Copy link
Author

No problem about the dependency manager switch. Go Mods is the official golang dependency manager, and we're happy to be on the latest and greatest.

Thanks for the info about --gomod-flags and for raising the new cmd issue.

E

@ptman
Copy link
Contributor

ptman commented Jul 21, 2020

I'm getting

$ revel run -a FOO
...
CRIT  15:40:42  revel  revel.go:292: Failed to import FOO with error:   error="package FOO is not in GOROOT (/usr/lib/go-1.14/src/FOO)" 

Sure. Why would it be in GOROOT? I created a new project using revel new reveltest and that runs just fine using revel run -a reveltest. Didn't spot differences in go.mod

Nevermind: go get -u -v ./... helped

@ptman
Copy link
Contributor

ptman commented Aug 24, 2020

Also remove vendor directory left by dep.

@eparziale
Copy link
Author

Hi @notzippy Congrats on the release of revel 1.1.0!

At this point, my development team has been using the revel framework for 4+ years on a website that serves 45k unique users per month. We have been very pleased with the framework.

Unfortunately, with the release of revel 1.1.0, all of our Continuous integration and deploy processes have broken.

This is because our app still targets revel 1.1.0 in go.mod and go.sum, but

go get github.com/revel/cmd/revel

now downloads revel cmd v1.1.0 instead of cmd v1.0.3
(https://github.com/revel/cmd/tags)

We currently run golang 1.14 on our servers. We are happy to upgrade to revel 1.1.0 and golang 1.17 in the coming weeks, but until we make those changes, it would be great if we can still build and deploy using revel 1.0.

For us, and other folks in our position, is there a way to maintain backwards compatibility with our previously working build steps (Copy/pasting from earlier comment)
image

Everything from the above works to set revel version to 1.0.0, except for

 go get github.com/revel/cmd/revel

Is there a way for us to still download revel cmd version 1.0.3 while staying on go 1.14?

Thanks!

Eric

@eparziale
Copy link
Author

eparziale commented Apr 12, 2022

For reference, the error we get when trying to test a revel 1.0.0 app with revel cmd 1.1.0 is

Revel executing: run all tests from the command-line
Parsing packages, (may require download if not cached)... Completed
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
main.testApp(0xc00019c000, 0x0, 0x0)
	/home/circleci/go/pkg/mod/github.com/revel/cmd@v1.1.0/revel/test.go:115 +0x176e
main.main()
	/home/circleci/go/pkg/mod/github.com/revel/cmd@v1.1.0/revel/revel.go:112 +0x212

Exited with code exit status 2

Another example, where trying to run the app fails

PS C:\Users\eparz\go\src> revel run -a app -m test
Revel executing: run a Revel application
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan receive]:
github.com/fsnotify/fsnotify.(*Watcher).Add(0xc0004b62c0, 0xc00082cd40, 0x3e, 0x27855001, 0xc0004aa4d0)
        C:/Users/eparz/go/src/github.com/fsnotify/fsnotify/windows.go:81 +0x158
github.com/revel/cmd/watcher.(*Watcher).Listen.func1(0xc00082cd40, 0x3e, 0xaa7040, 0xc0000987e0, 0x0, 0x0, 0x0, 0x0)
        C:/Users/eparz/go/src/github.com/revel/cmd/watcher/watcher.go:125 +0x1b3
github.com/revel/cmd/utils.fsWalk.func1(0xc00082cc40, 0x3e, 0xaa7040, 0xc0000987e0, 0x0, 0x0, 0x0, 0x2)
        C:/Users/eparz/go/src/github.com/revel/cmd/utils/file.go:241 +0x19f
path/filepath.walk(0xc00082cc40, 0x3e, 0xaa7040, 0xc0000987e0, 0xc000315be0, 0x0, 0x0)
        c:/go/src/path/filepath/path.go:364 +0xea
path/filepath.walk(0xc0006ae5d0, 0x2d, 0xaa7040, 0xc0006da8c0, 0xc000315be0, 0x0, 0xc000056200)
        c:/go/src/path/filepath/path.go:384 +0x306
path/filepath.walk(0xc0008095c0, 0x24, 0xaa7040, 0xc0004aa620, 0xc000315be0, 0x0, 0xc0004a6aa0)
        c:/go/src/path/filepath/path.go:384 +0x306
path/filepath.Walk(0xc0008095c0, 0x24, 0xc000ad3be0, 0x4, 0xc0008095c0)
        c:/go/src/path/filepath/path.go:406 +0x106
github.com/revel/cmd/utils.fsWalk(0xc0008095c0, 0x24, 0xc0008095c0, 0x24, 0xc000ad3cd0, 0x0, 0x40528a)
        C:/Users/eparz/go/src/github.com/revel/cmd/utils/file.go:243 +0x96
github.com/revel/cmd/utils.Walk(...)
        C:/Users/eparz/go/src/github.com/revel/cmd/utils/file.go:203
github.com/revel/cmd/watcher.(*Watcher).Listen(0xc0004b8200, 0xa98dc0, 0xc0004aa4d0, 0xc0004b6280, 0x4, 0x4)
        C:/Users/eparz/go/src/github.com/revel/cmd/watcher/watcher.go:134 +0x5ea
github.com/revel/cmd/harness.(*Harness).Run(0xc0004aa4d0)
        C:/Users/eparz/go/src/github.com/revel/cmd/harness/harness.go:314 +0x189
main.runApp(0xc000176000, 0x17, 0x0)
        C:/Users/eparz/go/src/github.com/revel/cmd/revel/run.go:142 +0x902
main.main()
        C:/Users/eparz/go/src/github.com/revel/cmd/revel/revel.go:112 +0x221

goroutine 87 [select, locked to thread]:
github.com/fsnotify/fsnotify.(*Watcher).sendEvent(0xc0004b62c0, 0xc000296280, 0x4d, 0x2, 0x4d)
        C:/Users/eparz/go/src/github.com/fsnotify/fsnotify/windows.go:522 +0x11e
github.com/fsnotify/fsnotify.(*Watcher).readEvents(0xc0004b62c0)
        C:/Users/eparz/go/src/github.com/fsnotify/fsnotify/windows.go:488 +0x321
created by github.com/fsnotify/fsnotify.NewWatcher
        C:/Users/eparz/go/src/github.com/fsnotify/fsnotify/windows.go:46 +0x1f8

Ah, I see that revel cmd 1.1.0 requires golang 1.17 revel/cmd@111264c

Yeah the question really is - Is there a way we can still go get revel 1.0.3?

@brendensoares
Copy link
Member

We're working to resolve this now.

@brendensoares
Copy link
Member

A v1.1.2 hotfix release for revel/cmd has been pushed.

Thanks for your patience.

@brendensoares brendensoares self-assigned this Apr 12, 2022
@brendensoares brendensoares added the priority-must now, top priority label Apr 12, 2022
@eparziale
Copy link
Author

Thanks so much for the quick fix!

We confirmed our CI process is working again. Really appreciate the help.

@brendensoares
Copy link
Member

We really appreciate your feedback and encouragement :)

@eparziale
Copy link
Author

Btw, in case it might help drive adoption/use of revel - our website is https://driverbase.com

If you potentially want to link to it from revel landing page - you could use it as a reference of the framework in action.

We could also add a "Powered by Revel" tag to our website to link back to the framework.

Happy to discuss, or chat about it.
https://driverbase.com/company/contact-us/

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-must now, top priority
Projects
None yet
Development

No branches or pull requests

5 participants