elvisdot / lewagon-setup Goto Github PK
View Code? Open in Web Editor NEWThe unoffical LeWagon setup doctor. A script that shows and fixes setup issues.
The unoffical LeWagon setup doctor. A script that shows and fixes setup issues.
the zsh install.sh
did not run yet and the 3 lines oh-my-zsh were removed. Everything else was okay. And the doctor refused to start because of missing dotfiles.
doctor version: 9f7d3d8
I thought that was a one time issue and new batches will not have it. But it keeps coming up. Investigate what the root cause is. And maybe let the doctor update the bundler at all times? Or just with the --fix flag.
gem update --system
bundle update --bundler
Should only be run if bundler --version
is too old (matching a known good version by the doctor) otherwise it slows down the doctor on a healthy system.
Invalid emails should always show a warning even if there is no active github auth we can check the email against.
Could also warn on unknown tlds or email providers but not sure if that has too many false positives. But it would catch typos of email providers.
Could also check if the most recent commit that is in the fullstack challenges repo has the same email as the current git email. As in the student changed the email in the git config but did not push anything yet.
There are a few issues or warnings if the clock is not setup correctly and ntp broke.
Lines 563 to 592 in 244735e
For example this ruby -e 'require "sqlite3"'
just to ensure the gem folder or ruby runtime is not corrupted?
Never seen this issue. I made it up. So not sure how much sense it makes.
sudo locale-gen "en_US.UTF-8"
sudo dpkg-reconfigure locales
locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
BROWSER
env var and installed browsers in programs dir
[ -z "$BROWSER" ] && echo "ERROR: please define a BROWSER environment variable ⚠️" || echo "Browser defined 👌"
exec: "xdg-open,x-www-browser,www-browser,wslview": executable file not found in $PATH
git -C $(brew --repo homebrew/core) checkout master
chsh
?? (did not investigate or solve yet)the tricky one idk how to even call it. But when homebrew is added to the path after rbenv init -
is ran
then it does not run and does not add the shims to the PATH
which makes it tricky to debug since rbenv is in the path and brew is and everything but the shims arent
so ruby wont be found in the rbenv dir and it falls back to the system ruby
so make sure to check that homebrews bin path is either in the zprofile or in the zshrc above the rbenv init
ssh -T [email protected]
is unhappy)
gh auth status
and ~/.ssh/config
grep "git_protocol: ssh" ~/.config/gh/config.yml
but I am sure https is also fine so leave itNameError: uninitialized constant Gem::Source
gem update bundler;bundle update --bundler
code --install-extension ms-vscode-remote.remote-wsl
zsh install.sh
)curl -s https://kitt.lewagon.com/camps/:batch/setup_script/:student | bash
)ssh -T [email protected]
and git username etcgh
cli for the email on github and compare it to ~/.gitconfig
cd ~/code/*/fullstack-challenges
git config --global user.email [email protected]
git commit --allow-empty -m "New commit with fixed email"
git push origin master
lipo
ruby/brew matches the current architecturetest/v3ext.c:201:24: error: implicitly declaring library function 'memcmp' with type 'int (const void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
CFLAGS="-Wno-error=implicit-function-declaration" RUBY_CONFIGURE_OPTS='--with-readline-dir=/usr/local/opt/readline/' arch -x86_64 rbenv install 3.1.2
RUBY_CFLAGS="-w" CFLAGS="-w" rbenv install 3.1.2
RUBY_CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline) --with-openssl-dir=$(brew --prefix openssl@3) --with-libyaml-dir=$(brew --prefix libyaml)" arch -arm64 rbenv install 3.1.2
sort -u
to detect issues where a echo PATHSTUFF >> .zshrc
was run too muchrails db:create
without creating a rails app?sudo -u postgres psql --command "CREATE DATABASE TestDbDeleteMe;"
# old mac
rm /usr/local/var/postgresql@15/postmaster.pid
# m1
rm /opt/homebrew/var/postgresql@15/postmaster.pid
brew services restart postgresql@15
psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
rake
can throw some nasty errors later onubuntu config --default-user new_user_name
(hope that works 🤞 )echo 'export GOOGLE_APPLICATION_CREDENTIALS=/path/to/the/SERVICE_ACCOUNT_JSON_FILE_CONTAINING_YOUR_SECRET_KEY.json' >> ~/.zshrc
csrutl status
should say enabled
do a test curl and check for this response
against github and lewagon urls
error 60: SSL certificate problem: certificate has expired
(60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a “bundle”
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn’t adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
the bundle, the certificate verification probably failed due to a
problem with the certificate (it might be expired, or the name might
not match the domain name in the URL).
If you’d like to turn off curl’s verification of the certificate, use
the -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
mv /etc/ssl/cert.pem /etc/ssl/cert.pem.org
curl https://curl.se/ca/cacert.pem > /etc/ssl/cert.pem
test this and if it fixes the error show it as suggested fix or fix with --fix
do not just edit that automatically
Its a common theme in my life that the unexpected solution to a weird problem was ipv4
but I think one of the first times I have seen it on a students native ubuntu laptop (took forever to debug)
So deactivating ipv6 might be worth hinting on certain problem descriptions.
But it is not very lewagon setup specific and a rather drastic change. So I suggest doing something more sophisticated like
properly checking if ipv6 is actually used by the current ISP. And then making sure it actually has a bad impact on the
current system.
One could quickly try pinging known important domains like the gem and yarn repo urls.
Or running a full gem/yarn command to see how toggling ipv6 impacts it.
Update: the doctor now has g_ipv6_ok
which is 0 if ping or curl to ipv6 did not work
the doctor does not show a warning unless --verbose
if ipv6 does not work. Because it is far too common
and not always an issue.
But now if yarn or gem commands fail and $g_ipv6_ok == 0
then the doctor could suggest it might be ipv6
Update: it happend again. We used networksetup -setv6off Wi-Fi
on a mac that got timeouts on vscode extension installs with ipv6 addresses in the error messages. That fixed it just fine. The doctor correctly set g_ipv6_ok=0
in that case. So on the vscode extension step the doctor could retry with networksetup -setv6off Wi-Fi
on failur if also is mac and is wifi. There is also networksetup -setv6off Ethernet
. I assume the command is not permanent. So it should for sure still show a warning that ipv6 had to be turned off to get something to work. If it is permanent on the other hand that would also be bad. The doctor should not permanently break ipv6.
ipv4 fallback for rubygems.org rubygems/rubygems#4555 (comment)
Even better would be some kind of linting for old bash versions.
Can shellcheck do it?
The doctor should auto detect this and all similar git corruption errors: https://stackoverflow.com/questions/11706215/how-can-i-fix-the-git-error-object-file-is-empty
A few students now had broken git folders because their machines shut down.
There are a few safe commands the doctor should run if it detects any issues. Such as git fsck
and then there are the more dangerous ones that should only be suggested or run when --fix is passed. Such as:
find .git/objects/ -type f -empty | xargs rm
git fetch -p
git fsck --full
cmd+shift+p "add to PATH"
can fail if the destination file which is at /usr/local/bin or somewhere like that is already set to an invalid sym link.
vscode does not automatically delete it. The doctor should do that even without --fix if a dead symlink is blocking the destination. Especially if the sym link is pointing to Desktop or Downloads instead of the Applications folder.
This can happen if vscode is installed to the PATH and then moved.
Somewhere in the logfile it says which role owns the database. If the postgres database was initialized on another macos user than the one in use now psql
will not be authed by default. So one has to do psql -U username -d postgres
and then create a role for it self.
Saw a system where the browser was configured to open json files
Then the "open settings json" button in the windows terminal would open the browser. Which does not allow to change the settings.json
The CI should fail if those are not matching official Le Wagon instructions
When verbosity is set to 2. Dump all postgres client and server binary paths. Show if port is used. Show all processes running that match pg. Show all brew installed pg and wether the service is active. Show all apple plist files. Show all pg pid files.
Possibly a --only=pg
would make sense. Could also add --only=dns
and similar. Which sets arg_only=
and then conditionally only runs one part of the doctor to not pollute output with unrelated warnings.
This repo is about helper scripts for the setup provided by the LeWagon coding bootcamp
https://github.com/LeWagon/data-setup
https://github.com/LeWagon/setup
There are two is one scripts:
Short for doctor. Also known as "the doctor" to sound epic.
The doctor is a non interactive shell script that can detect and optionally fix known setup issues.
By default it will not do any changes and only alert if it found possible issues.
When passed a --fix flag it will actually attempt to fix the issues.
There is no point in starting this if there is also chat gpt.
Short for Gwendoline. Also known as the robot TA.
Since the doctor is not interactive and only controlled by possibly complicated cli flags. Gwendoline acts as a fully interactive frontend.
Gwendoline tries to give non technical people a hand and help them talk to the doctor.
Gwendoline behaves similar to a techsupport chatbot. Ready for smalltalk and asking the user who he is and what he needs. And is then calling the doctor under the hood. At some point gwen should be able to fully replace all basic TA tasks. And properly responding to user input ranging from:
how to get all elements array?? HELP!
(could use codetogo.io)
to
LoadError: cannot load such file -- rspec/core/rake_task
todo: move those to a new issue
+ I forgot my password
on wsl launch powershell to set new passwd
+ unexpected end of input expecting end
+ rake works locally but not on kitt (if mac this can be due to filename casing)
Currently the doctor just references the setup instructions on how to get the dotfiles working. But it could also do it if it has a logged in github user. Make sure that it does not get stuck on the ssh (yes/no) prompt. And use some SSH flags or environment variables for the clone.
common issue on running bundle in rails projects
An error occurred while installing psych (5.1.1.1), and Bundler cannot continue.
WSL/Linux fix
sudo apt-get install libyaml-dev
Do not install libyaml-dev at all times. Also ideally do not install the psyche gem at all times. There has to be some non intrusive way to properly check this issue.
doc just calls powershell.exe but it might not be a command (seen that)
usage: uniq [-c | -d | -u] [-i] [-fields...
❌ possible fix:
echo $(($(printf 'a\na\nb\nb\nb' | sort | uniq -dc | awk '{print $1}' | paste -sd+)))
wsl --shutdown
netsh winsock reset
netsh int ip reset all
netsh winhttp reset proxy
ipconfig /flushdns
netsh winsock reset
shutdown /r
TODO
Get-Service LxssManager | Restart-Service
sc start LxssManager
or better this but it needs cmd and does not work in powershell
sc config LxssManager start=auto
also check for nullbytes in registry
https://gist.github.com/lhecker/393252fb1e95b3bc118d40ace802a505
sc.exe config wslservice start= demand
For example the extension in this loop printf '%b\n' "$WANTED_VSCODE_EXTENSIONS_WEB\n$win_ext" | while IFS='' read -r ext
the pipe creates a new context so they are not tracked.
Based on this I came up with the following china mirrow brew install command
HOMEBREW_BREW_GIT_REMOTE=http://mirrors.ustc.edu.cn/brew.git/ HOMEBREW_CORE_GIT_REMOTE=http://mirrors.ustc.edu.cn/homebrew-core.git/ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
The doctor could potentially check if behind the china firewall and then suggest running that command in case brew is detected as being unhealthy. This should not be needed for everybody.
It could also check the recommended china gem mirror from the official lewagon setup instructions.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.