From 2f3615eeefbdab59742c90cb58198cb5256b3e01 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Wed, 16 Aug 2023 09:40:44 +0000 Subject: [PATCH] added notes and dockerfile for pynode --- docker/py+npm.dockerfile | 20 ++++++++++++++++++++ linux disk.md | 20 ++++++++++++++++++++ linux/docker change storage.md | 26 ++++++++++++++++++++++++-- linux/docker install.md | 19 +++++++++++++++++++ linux/docker nvidia.md | 25 +++++++++++++++++++++++++ linux/linux disks.md | 16 ++++++++++++++++ 6 files changed, 124 insertions(+), 2 deletions(-) create mode 100644 docker/py+npm.dockerfile create mode 100644 linux disk.md create mode 100644 linux/docker install.md create mode 100644 linux/docker nvidia.md create mode 100644 linux/linux disks.md diff --git a/docker/py+npm.dockerfile b/docker/py+npm.dockerfile new file mode 100644 index 0000000..2bb3f6e --- /dev/null +++ b/docker/py+npm.dockerfile @@ -0,0 +1,20 @@ +# dobromirpopov/pynode +FROM python:slim + +# System dependencies +RUN apt-get update && apt-get install -y git && apt-get clean && rm -rf /var/lib/apt/lists/* + +# Upgrade pip +RUN pip install --upgrade pip + +# Install some basic utilities +RUN apt-get update && apt-get install -y \ + curl \ + && rm -rf /var/lib/apt/lists/* + +# Install Node.js and npm +RUN curl -sL https://deb.nodesource.com/setup_14.x | bash - +RUN apt-get install -y nodejs + +RUN node --version +RUN npm --version \ No newline at end of file diff --git a/linux disk.md b/linux disk.md new file mode 100644 index 0000000..837ba72 --- /dev/null +++ b/linux disk.md @@ -0,0 +1,20 @@ +# disk info +lsblk +sudo fdisk -l +sudo parted -l +gnome-disks + + +sudo umount -f /mnt + + +umount --lazy /mnt/data + + +## ntfs resize: +sudo ntfsfix /dev/sda2 +# Shrink the NTFS Partition: +sudo ntfsresize --size 100G /dev/sda2 (-f) + + +mkdir \ No newline at end of file diff --git a/linux/docker change storage.md b/linux/docker change storage.md index 795401e..25c6851 100644 --- a/linux/docker change storage.md +++ b/linux/docker change storage.md @@ -2,9 +2,12 @@ Stop the Docker daemon: >sudo systemctl stop docker Copy existing Docker data: If you already have images, containers, and volumes that you want to keep, you'll need to move them to the new location. Replace /new/path with the path to the directory where you want Docker to store its data. ->sudo rsync -aP /var/lib/docker/ /new/path/docker +>sudo rsync -aP /var/lib/docker/ /mnt/data/docker +>sudo rsync -aP --info=progress2 /var/lib/docker/ /mnt/data/docker + Edit the Docker configuration file: Open the Docker configuration file with a text editor like nano or vi. The location of this file might vary depending on your Linux distribution, but it's typically found at /etc/docker/daemon.json. If the file doesn't exist, create it. +rm -rf /mnt/data/docker >sudo nano /etc/docker/daemon.json Then add the following content, again replacing /new/path with your desired path: @@ -22,4 +25,23 @@ Verify the changes: Run a command like docker info | grep "Docker Root Dir" to e Optional - Clean up old data: If everything is working fine, and you have made a backup, you may want to remove the old Docker directory to free up space: ->sudo rm -rf /var/lib/docker/ \ No newline at end of file +>sudo rm -rf /var/lib/docker/ + + +rsync -aP /mnt/azure-resource-second-mount/host/mnt/apps/ /mnt/data/apps +rsync -aP --info=progress2 /mnt/azure-resource-second-mount/host/mnt/apps/ /mnt/data/apps/ +rm -rf /mnt/azure-resource-second-mount/host/mnt/apps/ + +rsync -aP --info=progress2 /mnt/azure-resource/apps/ /mnt/data/apps/ +rm -rf /mnt/azure-resource/apps/ + + +rsync -aP --info=progress2 /mnt/data/apps/ /data/apps +rm -rf /mnt/azure-resource/apps/ + + + +rsync -aP --info=progress2 /data/apps /mnt/data/apps +rm -rf /mnt/azure-resource/apps/ + + diff --git a/linux/docker install.md b/linux/docker install.md new file mode 100644 index 0000000..98765c1 --- /dev/null +++ b/linux/docker install.md @@ -0,0 +1,19 @@ +# install +sudo apt-get update +sudo apt-get install apt-transport-https ca-certificates curl software-properties-common +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" +sudo apt-get update +sudo apt-get install docker-ce + +# add portainer +docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v /mnt/storage/docker_volumes/portainer_data:/data portainer/portainer-ce + + +# start +sudo systemctl start docker +sudo systemctl enable docker + + +# build image +sudo docker build -t your-image-name . diff --git a/linux/docker nvidia.md b/linux/docker nvidia.md new file mode 100644 index 0000000..133b9ce --- /dev/null +++ b/linux/docker nvidia.md @@ -0,0 +1,25 @@ +3. Setup NVIDIA Container Toolkit: +Add the NVIDIA GPG key: + +bash +Copy code +curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - +Add the NVIDIA Docker repository: + +For distributions based on Ubuntu 18.04 and later: + +bash +Copy code +distribution=$(. /etc/os-release;echo $ID$VERSION_ID) +curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list +Install the NVIDIA Docker toolkit: + +bash +Copy code +sudo apt-get update +sudo apt-get install -y nvidia-docker2 +Restart Docker: + +bash +Copy code +sudo systemctl restart docker \ No newline at end of file diff --git a/linux/linux disks.md b/linux/linux disks.md new file mode 100644 index 0000000..bf9bc0f --- /dev/null +++ b/linux/linux disks.md @@ -0,0 +1,16 @@ +# list all fisks +lsblk -f + +# unmount forced +# you can try the lazy unmount option, which will immediately remove the filesystem from the file hierarchy and postpone the cleanup: +umount --lazy /mnt + +# make partition +fdisk /dev/sdX +fdisk p # existing partitions +# Press n to create a new partition. +# press w to write the changes to the disk. +sudo mkfs.ext4 /dev/sdXN +# mount + +docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always --pull=always -v /var/run/docker.sock:/var/run/docker.sock -v /mnt/apps/docker_volumes/portainer_data:/data portainer/portainer-ce \ No newline at end of file