This project implements explorer and other web2 applications for persistence ecosystem.
- Install
sdkman:curl -s "https://get.sdkman.io" | bashsource "$HOME/.sdkman/bin/sdkman-init.sh"
- Install
Java 11.0.x:sdk install java 11.0.11.hs-adpt
- Install
sbt 1.5.5:sdk install sbt 1.5.5
- Install
PostgreSQL 11:- MacOS (Make default username and password
postgresandpostgresrespectively) - Ubuntu:
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -RELEASE=$(lsb_release -cs)echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.listsudo apt updatesudo apt -y install postgresql-11sudo su - postgresorpsql -U postgrespsql -c "alter user postgres with password 'postgres'"exit
- MacOS (Make default username and password
- Click on
Databaseon right then on+->DataSource->PostgreSQL - Fill the following:
User:postgresPassword:postgresURL:jdbc:postgresql://localhost:5432/postgresDatabase:postgresSave:Forever- Do
Test Connectionthis should succeed. ThenApply->OK
- Select
0.sqlcontents and execute inconsole - Update
explorer.run.xmlwith correct values and the run. - Click on
Databaseon right then onstack + wrench, go toSchemaand selectpersistenceand all its tables.
sudo su - postgrespsql- Copy contents of
0.sqland paste there \qexit- Set all the environment variables in
application.conf(They are of form${NAME}) - Create binary for client:
- Go to project directory in terminal.
sbt cleansbt dist- You get a
assetMantle-1.0.zipfile which contains binary file inbinfolder.
- Modify
applicaltion.confas per the requirements. - Run
./persistenceclient
-
SFTP server:
- Create a new user
adduser your_username- OR
useradd -m your_user// will not ask for passwordsudo passwd your_user - Go to the user
su - your_user - Create a .ssh directory
mkdir .ssh - Go inside the directory
cd .ssh - Create a file authorized_keys
touch authorized_keys - Make a ssh key pair
ssh-keygen - Share the public key to whoever wants to connect Register the public keys of other users to authorized_keys ( can use command ssh-copy-id from remote or simple copy paste also works)
- Exit the directory
cd .. - Change permissions for the directory.
chmod 700 .ssh - Usually we create a directory inside of home where we allow sftp uploads or other requests
So change home directory permissions
chmod 755 . mkdir uploads/- Done!Now you can access the server via remote with sftp your_user@ip
- This will create a shell. Then you can navigate to uploads/ directory and use put and get commads
- Create a new user
-
SFTP SERVER with restricted access and no shell:
- Login to root
sudo adduser [username]- Create the file and insert the public key of users in this file
touch /etc/ssh/authorized_keys_username - Make the directory structure you want and keep the folder users can access at the last
sudo mkdir -p /var/sftp/../../second_last_Dir/accessibleDir/- Give root permissions to every folder before the last one :
sudo chown -R root:root /var/sftp/../../second_last_Dir/sudo chmod -R 755 /var/sftp../../second_last_Dir/
- Give sftp permissions to last folder :
sudo chown username:username /var/sftp/../../second_last_Dir/accessibleDir/ - Change sshd config file to disable shell access and disable password login:
sudo nano /etc/ssh/sshd_config- Match User
username - AuthorizedKeysFile /etc/ssh/authorized_keys_%u
- ForceCommand internal-sftp
- PasswordAuthentication no
- ChrootDirectory /var/sftp/../../second_last_Dir
- PermitTunnel no
- AllowAgentForwarding no
- AllowTcpForwarding no
- X11Forwarding no
- Match User
- Restart sshd to apply changes:
sudo systemctl restart sshd - Login from user as..
sftp -i “private_key_of_authorized_public_key” username@ip
Building container image with docker in macos will be slower as there is no native docker support
-
Install docker on your machine
-
Macos: Orbstack
-
Linux
curl -sL get.docker.com | sudo bash docker version -
-
Setup keystore named
mantlekeystorein root of the repository -
Run postgres, testnet and explorer containers
# enable buildx
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
# spin up postgres
docker-compose up -d postgres
# spin up testnet
docker-compose up -d testnet
# spin up explorer
docker-compose up -d explorer# Stop postgres, testnet and explorer containers
docker-compose down
# Remove testnet data
docker volume client_testnet-data
# Remove postgres data
docker volume client_explorer-postgresql-dataOnly docker with buildx required
docker buildx build \
--output=type=local,dest=./ \
--secret=id=git,src=$HOME/.ssh/id_rsa \ # For clienttools
--build-arg=APP_VERSION=$(git rev-parse --short HEAD) \.