Coder Social home page Coder Social logo

local_mint's Introduction

Hacker's Kotlin Local on Mint

Version: dm: LightDM Distro: Linux Mint 21.2 Victoria base: Ubuntu 22.04 jammy

This serves as an exposé and example of the typical competent local setup for the modern 12-factor-app development workflow within * fluent-development-style* of Extreme Programming (XP). This is how the world's most competent and performant software engineers, "hackers," work to disrupt markets, generate value and profit, and make the world a better place. - and so can you!

Basic Principles

  1. There's only production, and your local is part of it, treat it as such: Factor X
  2. Only absolutely common packages and configurations are global configurations.
  3. The world is multifaceted, and so Linux is multiuser.

The Global Setup Journey

OS Setup - Everything begins with the local...
  1. Install your OS: Linux Mint, a Mate Desktop Environment in our case, but you are free to choose any or many available - beginner's guide.
  2. Concept: Your first user is reserved for you and is the only user with sudo access. If you have multiple customers or entities to code for separate them by creating additional accounts, leaving the first one untarnished. If you have separate boxes for separate gigs like we do the one user may suffice for you, yet a separate single user for coding is best recommended.
  3. Upgrade base packages: step 01 - the base
  4. Configure your shell: step 02 - the 'oh your shell'
  5. Useful Global Apps!: step 03 - global apps

From this point, each local-user development toolset is configured "as a user," including if only one user opted to be used.* The actual development environment is encapsulated by a Linux user.

Dev User Keys Setup

This sequence applies to each local development user.

Configure Git

Instructions - Git Client, initial setup
git config --global user.name "yer-github-handle"
git config --global user.email "[email protected]"
git config --list --show-origin

SSH Key - Authentication

Instructions - SSH Key
# Okay to accept all defaults
ssh-keygen -t ed25519
  • Copy public key into clipboard:
sudo apt install xclip
cat ~/.ssh/id_ed25519.pub | xclip -i -sel clip
  • Navigate to your account keystore: https://github.com/settings/keys
  • Paste public key from clipboard into the Key field,
    • leave Key type as "Authentication Key"
    • provide no Title
    • press Add SSH Key

GPG keys - Signing

Instructions - GPG Key Setup, Signing

NOTE: This Mint distribution has all the required packages and no need to install anything. Alternatively one needs sudo apt install gnupg gnupg-agent pinentry-gnome3 or if gnupg2 package is desired instead sudo apt install gnupg2 gnupg-agent pinentry-gnome3

  • Generate a new GPG key:
# Test for Pin Entry; else install from comments above
echo GETPIN | pinentry

gpg --full-generate-key
gpg --list-secret-keys --keyid-format=long
  • Copy value after rsaNNNN/ ,such as 3AA5C34371567BD2
  • Export key armor into clipboard:
gpg --armor --export 3AA5C34371567BD2 | xclip -i -sel clip
git config --global --unset gpg.format
gpg --list-secret-keys --keyid-format=long
git config --global user.signingkey 3AA5C34371567BD2
git config --global commit.gpgsign true
git config --list --show-origin

echo -e '\nexport GPG_TTY=$(tty)' >> ~/.zprofile
  • Test signing a commit and pushing to see the verified tag:
git commit -S -m "YOUR_COMMIT_MESSAGE"
git push

IDE Setup

SDK Manager Setup

Instructions - SDK Manager Setup
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"

sdk install java
sdk install kotlin
sdk install gradle

sdk current  
IMPROVEMENT - Seggregate Shell Elements

NOTE: The installer will assume single zsh config file target. Instead edit these files as follows:

#.zshenv
# ...
export SDKMAN_DIR="$HOME/.sdkman"
#.zprofile
# ...
export GPG_TTY=$(tty)
#.zshrc
# ...
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh"

JetBrains Toolbox Setup

Instructions - Example Toolbox Setup, IDEA
mkdir ~/opt
cd ~/Downloads/              
wget https://download-cdn.jetbrains.com/toolbox/jetbrains-toolbox-2.0.4.17212.tar.gz
tar -xvzf jetbrains-toolbox-2.0.4.17212.tar.gz -C ~/opt
cd ~/opt
./jetbrains-toolbox

GitHub Integration

Most hackers work directly with GitHub CLI which allows not only ordinary Git operations by a wrapper but also direct controls over the entire GitHub API, driving all aspects of the DevOps lifecycle such as pull requests from right under your fingertips.

GH CLI - the Gist of it!
  • Assumptions:
    • SSH Authentication Key is configured, i.e. ed25519.
    • Default Git protocol is SSH and not HTTPS.
    • GPG Signing Key is configured.
    • Local Git Client signs commits by default.
  • Next Steps:
    • Install GH client EITHER as a local user, OR globally with Apt.
    • Configure Key using JetBrains IDE.
    • Run gh config set git_protocol ssh --host github.com to set Git protocol to SSH.
    • Run gh config set browser google-chrome to set Browser to Google Chrome.
    • Run gh repo clone aaronfllr/local_mint to test by cloning my repo.
      • though you should really fork!
GH Install - Global Install Example
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& sudo apt update \
&& sudo apt install gh -y
GH Configure - IDE Task Key Example
  • Connect tasks:
  • Generate token through IDE and "Test" it:
Add to the environment - Add token environment variable to ~/.zshenv
vi ~/.zshenv

# Add a line that looks like so:
export GITHUB_TOKEN="ghp_YerIdeGeneratedToken"
# Test with:
gh auth status
# Should report authenticated by token
gh auth logout
gh auth status
# Should still report unauthenticated by token
# Example of authenticated response:~ gh auth status                                  
github.com
  ✓ Logged in to github.com as yer-handle (GH_TOKEN)
  ✓ Git operations for github.com configured to use ssh protocol.
  ✓ Token: ghp_************************************
  ✓ Token scopes: gist, notifications, read:audit_log, read:gpg_key, read:org, read:project, read:user, repo, user:email, workflow, write:discussion, write:packages

Here is the entire manual: https://cli.github.com/manual/

Enjoy!

local_mint's People

Contributors

rdd13r avatar aaronfllr avatar

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.