tt icon indicating copy to clipboard operation
tt copied to clipboard

Consider extending default ignore list on pack

Open DifferentialOrange opened this issue 10 months ago • 6 comments

Now tt pack ignores some files (for example, .git and .gitignore) on artifact packing by default. There are some popular scenarios that seems to better be covered by default.

Command packs previous artifact

$ tt create vshard_cluster --name myapp290324
   • Creating application in "/home/moiseevgeorgy/Development/sandbox/myapp290324"
   • Using built-in 'vshard_cluster' template.
Bucket count (default: 3000): 
Storage replication sets count (default: 2): 
Storage replicas per replication set count (>=2) (default: 2): 
Routers count (default: 1): 
   • Application 'myapp290324' created successfully
What's next?
Build and start 'myapp290324' application:
    $ tt build myapp290324
    $ tt start myapp290324

Pay attention that default passwords were generated,
you can change it in the config.yaml.
$ cd ./myapp290324/
$ tt init
$ tt pack
$ tt pack tgz
   • Generating new tt.yaml for the new package
   • Apps to pack: myapp290324 
   • Running rocks make       
No existing manifest. Attempting to rebuild...
   • Application was successfully built
   • myapp290324 rocks are built successfully
   • Creating tarball.        
   • Bundle is packed successfully to /home/moiseevgeorgy/Development/sandbox/myapp290324/myapp290324-0.1.0.0.x86_64.tar.gz.
$ tar -ztvf myapp290324-0.1.0.0.x86_64.tar.gz 
drwx------ moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:53 .
drwxr-x--- moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:53 bin
...
drwxr-x--- moiseevgeorgy/moiseevgeorgy        0 2024-03-29 17:53 myapp290324/templates
-rw-r--r-- moiseevgeorgy/moiseevgeorgy     1495 2024-03-29 17:53 myapp290324/tt.yaml
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy      365 2024-03-29 17:53 tt.yaml

Rebuild the artifact after some changes.

$ tt pack tgz
$ tar -ztvf myapp290324-0.1.0.0.x86_64.tar.gz 
drwx------ moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:55 .
drwxr-x--- moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:55 bin
...
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy 25630806 2024-03-29 17:55 myapp290324/myapp290324-0.1.0.0.x86_64.tar.gz
...
drwxr-x--- moiseevgeorgy/moiseevgeorgy        0 2024-03-29 17:55 myapp290324/templates
-rw-r--r-- moiseevgeorgy/moiseevgeorgy     1495 2024-03-29 17:55 myapp290324/tt.yaml
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy      365 2024-03-29 17:55 tt.yaml

Rebuild the artifact after more changes.

$ tt pack tgz
$ tar -ztvf myapp290324-0.1.0.0.x86_64.tar.gz 
drwx------ moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:56 .
drwxr-x--- moiseevgeorgy/moiseevgeorgy 0 2024-03-29 17:56 bin
...
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy 51182800 2024-03-29 17:56 myapp290324/myapp290324-0.1.0.0.x86_64.tar.gz
...
-rw-r--r-- moiseevgeorgy/moiseevgeorgy     1495 2024-03-29 17:56 myapp290324/tt.yaml
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy      365 2024-03-29 17:56 tt.yaml

And so on.

Command packs credentials file

$ cat tt.yaml
ee:
  credential_path: ./credentials.txt
$ cat credentials.txt
mylogin
mypassword
$ tt pack tgz
$ tar -ztvf myapp290324-0.1.0.0.x86_64.tar.gz
drwx------ moiseevgeorgy/moiseevgeorgy 0 2024-03-29 18:03 .
drwxr-x--- moiseevgeorgy/moiseevgeorgy 0 2024-03-29 18:03 bin
...
-rw------- moiseevgeorgy/moiseevgeorgy       20 2024-03-29 18:03 myapp290324/credentials.txt
...
-rw-r--r-- moiseevgeorgy/moiseevgeorgy      1495 2024-03-29 18:03 myapp290324/tt.yaml
-rw-rw-r-- moiseevgeorgy/moiseevgeorgy       365 2024-03-29 18:03 tt.yaml

DifferentialOrange avatar Mar 29 '24 15:03 DifferentialOrange

Why do we need to chdir to the application directory and create one more env there? Why is this a popular scenario?

psergee avatar Mar 30 '24 17:03 psergee

Why do we need to chdir to the application directory and create one more env there?

I chdir to application directory to develop my application. I create env per application since this is the way I usually work with local environment: Lua rocks, Python venv, git. If it is forbidden, let's forbid to work like this in documentation and, if possible, with tt init call. As far as I remember env discussions, it was planned that env inside the application is fine.

Why is this a popular scenario?

Do we have any statistics or independent research on non-tt developers which scenarios are popular? I think we're not.

DifferentialOrange avatar Apr 01 '24 08:04 DifferentialOrange

tt init --help says

Create tt environment config for application in current directory

and for me it sounds like it encourages to create per-application env, not forbids it.

DifferentialOrange avatar Apr 01 '24 08:04 DifferentialOrange

let's forbid to work like this in documentation

Cannot be forbidden due to cartridge-cli compatibility.

Do we have any statistics or independent research on non-tt developers which scenarios are popular?

There are some popular scenarios

Please ask the author of the comment above.

psergee avatar Apr 01 '24 09:04 psergee

Please ask the author of the comment above.

Yeah, that's fair. Do we have a proper step-by-step guide on how to work with tt-compatible application (full cycle, not separate commands)? It seems that my understanding of the approach is not the same as you have.

DifferentialOrange avatar Apr 01 '24 12:04 DifferentialOrange

By popular scenarios, I have meant "re-pack application that has been packed some time ago" and "pack application if I work with credentials". If my issues do not directly tied to these but to some other things -- let's at least fixate it here.

DifferentialOrange avatar Apr 01 '24 12:04 DifferentialOrange