apolopena / gitpod-laravel-starter

Configurable LAMP or LEMP stack starter project powered by Laravel and Gitpod. Supports Laravel 6, 7, and 8. Out of the box support for React, Vue, and Bootstrap frontends, with or without built-in auth .
https://github.com/apolopena/gitpod-laravel-starter/wiki
MIT License
40 stars 44 forks source link

Anything written to ~/ does not persist. ~/.gitconfig, ~/.rake, etc.. #30

Closed apolopena closed 3 years ago

apolopena commented 3 years ago

Describe the bug

When a workspace is stopped and restarted. ~/.rake is blasted away and so is anything written to ~/.gitconfig. In fact any files that are written in the init phase that are not in /workspace (or deeper) will not be there on subsequent startups of the workspace. A seperate but related issue is that also the initialization log /var/log/workspace-init.log turns into a zero byte file on subsequent starts of a workspace because the docker image writes that file empty and expects the init task to populate it, which it does.... once..... /var/log/workspace-image.log is fine because the docker image writes to it. /var/log/xdebug.log is fine to be reset on every startup aswell unless we wanted to log to persist between startups of the workspace.

UPDATE: this bug has been addressed in Feature https://github.com/apolopena/gitpod-laravel8-starter/issues/31

td;LR Anything that is written to ~/ from anywhere will not persist.

Screenshots

Steps to reproduce

  1. Create a new workspace
  2. Stop the workspace
  3. Start the workspace
  4. run: git a and the output is:
    
    git: 'a' is not a git command. See 'git --help'.

The most similar commands are add am

5. run `ls ~/.rake` and the output is:

ls: cannot access '/home/gitpod/.rake': No such file or directory

### Expected behavior for running `git a`
Output for (at a minimum) should be:

alias.aliases config --get-regexp '^alias.' alias.a config --get-regexp '^alias.' alias.cap !f() { git add .; git commit -m "$@"; git push; }; f alias.new !f() { git cap "📦 NEW: $@"; }; f alias.imp !f() { git cap "👌 IMPROVE: $@"; }; f alias.fix !f() { git cap "🐛 FIX: $@"; }; f alias.rlz !f() { git cap "🚀 RELEASE: $@"; }; f alias.doc !f() { git cap "📖 DOC: $@"; }; f alias.tst !f() { git cap "🤖 TEST: $@"; }; f alias.brk !f() { git cap "‼️ BREAKING: $@"; }; f alias.lg log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit


### Expected behavior for running `ls ~/.rake`
Output (at a minimum) should be:
 `changelog.rake`

### Additional information
Currently and unfortunately Gitpod does not persist anything in `~/` (/home/gitpod).

The hack here could be to take out anything that parses, copies or write new files to `~/` and move that into a `before` task in `.gitpod.yml` (UPDATE: this worked for the git aliases and the rake tasks). 

`before` tasks run before the `init` command but unlike the `init` command `before` tasks run everytime the workspace is started so take that into consideration.

A system for persisting files needs to be devised.
apolopena commented 3 years ago

Hack required This bug applies to anything not written to /workspace. Currently Gitpod only persists /workspace This means that if we want to preserve the init logs in /var/log, they will need to be copied to /workspace furthermore there will file collisions wunless those files copied to /workspace are put in a folder specifc to that project but not the same name as that project. for example log files for the project test would need to go into /workspace/test-files