Academia JavaEE Workspace in MacOS: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
No edit summary
Line 25: Line 25:
</source>
</source>


|}
|-
 
|colspan="2"|
==GraalVM==
'''GraalVM:'''
----
|-
|valign="top" colspan="2"|
<source lang="bash">
<source lang="bash">
sudo wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/\
sudo wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/\
Line 39: Line 42:
export JAVA_HOME=$GRAALVM_HOME
export JAVA_HOME=$GRAALVM_HOME
</source>
</source>
|}


==PostgreSQL==
==PostgreSQL==

Revision as of 07:51, 11 March 2022

Java

/usr/libexec/java_home -v1.8.0_321
/usr/libexec/java_home -v1.8.0_241
/usr/libexec/java_home -v1.7.0_80
/usr/libexec/java_home -v1.8.0
sudo rm -rf /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/
sudo rm -rf /Library/Java/JavaVirtualMachines/jdk-11.0.6.jdk/

export JAVA_HOME=`/usr/libexec/java_home -v1.8.0`
brew install java11
brew install maven
brew install ant

GraalVM:


sudo wget -c https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.0.0.2/\
 graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz -P /Library/Java/JavaVirtualMachines/

sudo tar -xvzf /Library/Java/JavaVirtualMachines/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz\
 -C /Library/Java/JavaVirtualMachines/

sudo rm -rf /Library/Java/JavaVirtualMachines/graalvm-ce-java17-darwin-amd64-22.0.0.2.tar.gz 
export GRAALVM_HOME=/Library/Java/JavaVirtualMachines/graalvm-ce-java17-22.0.0.2/Contents/Home
export JAVA_HOME=$GRAALVM_HOME

PostgreSQL

Install

brew services stop postgresql
brew uninstall postgresql
brew cleanup

rm -rf ~/Library/LaunchAgents/homebrew.mxcl.postgresql*
rm -rf  /usr/local/var/postgres*

brew install postgres
brew services start postgresql
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
brew services list

vim /usr/local/var/postgres/postgresql.conf 
: <<'END_COMMENT'
listen_addresses = '*'                 # what IP address(es) to listen on;
                                       # comma-separated list of addresses;
                                       # defaults to 'localhost'; use '*' for all
                                       # 'localhost,10.19.83.10'
                                       # (change requires restart)
END_COMMENT

vim /usr/local/var/postgres/pg_hba.conf
: <<'END_COMMENT'
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
host    all             all             10.19.83.1/24           trust
END_COMMENT

createuser -s postgres
createuser $USER
createdb $USER
CREATE USER postgres SUPERUSER;
CREATE DATABASE postgres WITH OWNER postgres;

Create

CREATE DATABASE academia;
CREATE USER academia WITH ENCRYPTED PASSWORD 'academia';
GRANT ALL PRIVILEGES ON DATABASE academia TO academia;
psql academia < academia.sql
psql -h db00.chorke.org -p 5432 -d academia -U academia
psql -h db00.chorke.org -p 5432 -d academia -U academia -W -f academia.sql
pg_restore -h db00.chorke.org -p 5432 -d academia -U academia academia.dump

Delete

REVOKE CONNECT ON DATABASE academia FROM public;
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname in ('academia');
ps -ef | grep postgres
kill -9 PID
DROP DATABASE IF EXISTS academia;

Redis

brew services stop redis
brew uninstall redis
brew cleanup

rm -rf ~/Library/LaunchAgents/homebrew.mxcl.redis* 
rm -rf  /usr/local/var/redis*

brew install redis
brew services start redis
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
vim /usr/local/etc/redis.conf
brew services list

Workspace

mkdir -p $HOME/chorke
mkdir -p /opt/dev/$USER/chorke/academia
chown $USER:$USER -R /opt/dev/$USER

export ACADEMIA_WSS="$HOME/chorke/academia"
ln -s /opt/dev/$USER/chorke/academia $ACADEMIA_WSS
ls -lah $HOME/chorke
vim ~/.bash_profile

Git SCM

ssh-keygen -t rsa -b 4096 -C "[email protected]"
: <<'END_COMMENT'
Generating public/private rsa key pair.
Enter file in which to save the key (/home/user/.ssh/id_rsa): /home/user/.ssh/git_academia_chorke_org_rsa
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/user/.ssh/git_academia_chorke_org_rsa
Your public key has been saved in /home/user/.ssh/git_academia_chorke_org_rsa.pub
The key fingerprint is:
SHA256:TXBbBINcPcVtdVFRjs/P+jaxMFAIwr3uqdlt8tmrLVQ [email protected]
The key's randomart image is:
+---[RSA 4096]----+
|      .oo+*++o.+@|
|       .++ =o..o+|
|          + .....|
|         + . E o |
|        S . o   o|
|         . . o o.|
|        . o   o =|
|        o+.o+  +.|
|       o..+=o+ooo|
+----[SHA256]-----+
END_COMMENT
ls -lah ~/.ssh/
cat < ~/.ssh/git_academia_chorke_org_rsa.pub
nano ~/.ssh/config
: <<'END_COMMENT'
Host git.academia.chorke.org
     HostName git.academia.chorke.org
     PreferredAuthentications publickey
     IdentityFile ~/.ssh/git_academia_chorke_org_rsa
     User git
END_COMMENT
git config --global user.email "[email protected]"
git config --global user.name "FULL NAME"
ssh -vT git.academia.chorke.org

Knowledge

disk usage
du -h /var
du -sh /var
du -csh ~/Do*
du -csh /var/log /var/lib
du -sh --apparent-size /var/lib
du -h /var/ | sort -rh | head -5
#nano ~/.bashrc
#nano ~/.zshenv
#nano ~/.profile
#nano ~/.bash_profile
export ACADEMIA_WSS="$HOME/chorke/academia"
export ACADEMIA_LOG_PATH="$HOME/.chorke/academia/var/http/logs"
source ~/.bashrc
source ~/.profile
source ~/.bash_profile

source ~/.zshenv
source ~/.zprofile/.zlogin
git stashing
git stash; git checkout -b new_branch; git stash pop
git add .; git commit -m "new feature added"; git push 
ssh-keygen -p -f ~/.ssh/git_academia_chorke_org_rsa
: <<'END_COMMENT'
Enter old passphrase: 
Key has comment '[email protected]'
Enter new passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved with the new passphrase.
END_COMMENT
comment and uncomment sql
sed -i -e 's|^|-- |g' src/main/resources/db/migration/*.sql
sed -i -e 's|^-- ||g' src/main/resources/db/migration/*.sql

References