5

Each week so far it takes me over 1.5 hours to bring my dev environment up to date after updating the plutus-pioneer-program and plutus-app repos. This is really painful.

I'm wondering if someone can show me how to improve this startup time - possibly avoid unneeded steps, suggest some optimization settings (if any exist)...

I've listed my environment update process below. Any advice on how to streamline this and reduce my startup time would be much appreciated. Note I'm running on Intel Mac (BigSur), I'm in Cohort 3, I'm new to nix and cabal and for the first two weeks I had trouble getting the playground up reliably so after much experimenting I'm down to the following process that seems to work, but it takes a long time!

Summary of steps I need to do each week:

  1. open a terminal and run from my PPP code directory:
cd plutus-pioneers-program
git pull origin plutus-pioneers-program // gets main branch
  1. look inside code/weekxx/cabal.project and find latest plutus-app commit branch -> say ABCDEF
  2. cd to plutus-app directory and do the following
 a) git pull origin plutus-apps // gets main branch 
 b) git checkout ABCDEF   // to align plutus-apps code with this week's ppp commit
 c) nix-build -A plutus-playground.client
 d) nix-build -A plutus-playground.server
 e) nix-build -A plutus-playground.generate-purescript
 f) nix-build -A plutus-playground.start-backend

Generally these first steps are reasonably fast although sometimes the nix-builds can take up to 5 min each.

  1. Then I run
nix-shell -v   // -v gives verbose output... nice to watch that it is doing something  

this can take a long time each week: 30-60 min

  1. within the shell I run
cd ../plutus-playground-client
plutus-playground-generate-purs    // this can take a while
GC_DONT_GC=1 plutus-playground-server   // start server
  1. open a new terminal/tab at plutus-app root and run
nix-shell -v // again

generally the second nix shell is faster - completing in 5-10 minutes.

  1. within this shell
cd ../plutus-playground-client
GC_DONT_GC=1 npm start   // to start the playground ui 
  1. open a 3rd terminal/tab at plutus-app root and run
nix-shell -v // again for cabal repl

similar startup time to 2nd shell

  1. within this 3rd shell access cabal repl with
cd ppproot/plutus-pioneers-program/code/weekxx   // where xx is week # like 03
cabal repl 

this takes another 30 minutes to load/build all the dependencies. Do I really need them all?

At this point I finally have a stable playground to use !!

  1. sometimes I also open another nix-shell and boot up the doc server if I need that.
2
  • I don't see anything here that can't be automated with a bit of shell scripting. Checking for the newest branch could probably be done with something like 'git branch | tail -1'. Why not write a cron job that starts all of this at 4 am, so it's ready when you get up? Jan 31 at 13:36
  • yeah I can do the scripting, just wondering if I'm including stuff that doesn't need to be done. For example do I really need all the nix-shells or is there some way I launch some of these processes as background processes from one nix-shell - I've tried but things don't seem to work Jan 31 at 23:23

2 Answers 2

4

My weekly setup steps are similar to yours. But there's a few steps you do that I skip and, so far, haven't had any issues.

I've never ran any of these:

nix-build -A plutus-playground.client
nix-build -A plutus-playground.server
nix-build -A plutus-playground.generate-purescript
nix-build -A plutus-playground.start-backend

or

plutus-playground-generate-purs

Everything else I do in basically the same order you do.

1
  • thanks, I'll try removing these. They were required in the initial install (at least in the instructions I used). Anybody know why or when these would need to be rerun? Under what conditions, if ever? Jan 31 at 23:20
2

You can create command aliases or write bash scripts to automate certain commands. An example of aliases I've written for myself (in Linux):

alias plutus-nix='cd /home/datapool/plutus-apps; GC_DONT_GC=1 nix-shell'
alias plutus-server='cd plutus-playground-client;  GC_DONT_GC=1 plutus- 
         playground-server'
alias plutus-client='cd plutus-playground-client;  GC_DONT_GC=1 npm 
         start'

So basically I just run commands like plutus-nix -> plutus-server when I want the server, and plutus-nix -> plutus-client when I want the client.

Bear in mind I can do this easily in Linux but I would think it should be OK to write aliases as well in MacOS.

2
  • yes I could definitely use aliases to help with this. Any thoughts on what I could do to speed these steps up? Jan 31 at 23:21
  • Which shell do you use? You can put the aliases on the configuration file for your shell environment. For instance I use bash so I put my aliases in my .bashrc in my home folder.
    – d_fajardo
    Feb 1 at 6:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.