Coder Social home page Coder Social logo

Comments (14)

AurangAsif avatar AurangAsif commented on July 24, 2024 1

Thanks for the reply. So you would have to change the destination manually in the env variables every time, correct? Like, you can't change it from terminal once you're in a code-server session.

You could change the env vars everytime, or manually run rclone commands. Or just make a shell script with the following contents and run it everytime you change the destination. Copied from the entrypoint.sh script.

RCLONE_REMOTE_PATH=${RCLONE_REMOTE_NAME:-code-server-remote}:${RCLONE_DESTINATION:-code-server-files}
echo "rclone sync $RCLONE_FLAGS $RCLONE_SOURCE_PATH $RCLONE_REMOTE_PATH -vv" > /home/coder/push_remote.sh
echo "rclone sync $RCLONE_FLAGS $RCLONE_REMOTE_PATH $RCLONE_SOURCE_PATH -vv" > /home/coder/pull_remote.sh

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024 1

I made some small edits to entrypoint.sh. It should be a bit more clear now. So if I'm in the middle of one project, I can run ./push-and-pull-from.sh [project name] and it will let me set a new destination to push to (probably have to delete any current unrelated files before I push). But I will look into Railway as you said. Thanks!

from deploy-code-server.

AurangAsif avatar AurangAsif commented on July 24, 2024

To stop auto-pulling from rclone, you can set the RCLONE_AUTO_PULL env var to false (it has a default value of true). As for sub directories, if you set an id for a root folder when configuring rclone, then you can use the RCLONE_DESTINATION env var, Setting it to / will sync everything in the folder. Setting it to something like project1 will create a folder inside the gdrive folder and sync everything into and out of there.

To see a full list of env vars, check out https://github.com/cdr/deploy-code-server/tree/main/deploy-container.

Edit: NOTE: If you are going to try the sub directory methods I mentioned above, I suggest you:

  1. Create a new rclone config in a new test folder
  2. Push atleast 1 folder and file into it
  3. Change RCLONE_DESTINATION to a subfolder
  4. Try pushing some files

If any files get deleted than do not use the method. Otherwise, you should be good to go.

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024

Thanks for the reply. So you would have to change the destination manually in the env variables every time, correct? Like, you can't change it from terminal once you're in a code-server session.

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024

Thanks. I ended up putting shell script in the .vscode directory in /home/coder/project, and I replaced -code-server-files with the name of the new project directory in google drive. RCLONE_SOURCE_PATH=${RCLONE_SOURCE:-$START_DIR} is also required for the last two commands.

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

Thanks. I ended up putting shell script in the .vscode directory in /home/coder/project, and I replaced -code-server-files with the name of the new project directory in google drive.

I'm not sure I'm following. Wouldn't this be solved if you just specified a unique RCLONE_DESTINATION environment variable when creating it? This would send each project to a unique google drive folder.

Do you need to edit the location after the fact?

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024

Yeah, I was trying to find a way to change the destination after opening code-server. Instead of changing the Env variables beforehand. I put it in the .vscode directory because I am pulling from an empty base project (that has .vscode) to set the theme from settings.json every time, but I should really just make the shell script in entrypoint.sh...

Apart from the shell script, is there a better way to do this?

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

Instead of changing the Env variables beforehand.

if you change the env variables after you open vs code, it will rebuild the workspace

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024

I run this inside vscode and specify the new destination as an argument. After pushing, everything seems to be fine. Am I doing something wrong? Sorry, I didn't mean to say I was changing the env variables, only push_remote.sh and pull_remote.sh.

RCLONE_SOURCE_PATH=${RCLONE_SOURCE:-$START_DIR}
RCLONE_REMOTE_PATH=${RCLONE_REMOTE_NAME:-code-server-remote}:${RCLONE_DESTINATION:-$1}

echo "rclone sync $RCLONE_SOURCE_PATH $RCLONE_REMOTE_PATH -vv" > /home/coder/push_remote.sh
echo "rclone sync $RCLONE_REMOTE_PATH $RCLONE_SOURCE_PATH -vv" > /home/coder/pull_remote.sh

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

Totally not doing anything wrong at all! I was mainly confused what it was doing differently from setting the env variable beforehand. In railway itself, you can set the variables after you first deploy it, and then it would redeploy with that variable configured in the environment.

However, passing it as an argument gives you more control. Or do you have multiple projects per railway? That also makes sense! We can add this as an option

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

Sweet! So I will definitely implement this, and it will go like

  1. check if argument ($1 exists)
  2. if not, use $RAILWAY_DESTINATION (if exists)
  3. if not, use "code-server-remote" (if exists)

from deploy-code-server.

tmprk avatar tmprk commented on July 24, 2024

Wait, sorry if I'm misunderstanding. But when would these 3 occur? I thought the argument is something that is given to change the rclone destination after you open code-server, not during entry point of the container.

And I deployed it to Railway but the workflow seemed pretty much the same. What would the value for $RAILWAY_DESTINATION be? I currently only have one railway project btw.

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

RAILWAY_DESTINATION would just be the name of the single folder that it goes to.

Yeah I would probably rewrite the push_remote and pull_remote to take in arguments, like yours does

from deploy-code-server.

bpmct avatar bpmct commented on July 24, 2024

closing because i believe this use case is more centered around supporting multiple remotes

from deploy-code-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.