주식

 sudo docker network create work

## Working container
sudo docker rm -f stock
sudo docker run -it --name stock --restart always --network work -p 3838:3838 debian
#sudo docker run -it --name stock --restart always --network work -p 8888:8888 -p 8787:8787 -p 3838:3838 debian
echo 'Acquire::http::Proxy "http://rcc.work:3142";' > /etc/apt/apt.conf
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime 
apt-get -y update && apt-get -y upgrade
apt-get -y install apt-utils dialog curl nano sudo procps cron
cd ~; mkdir -p ~/.local; mkdir -p ~/.pip; curl -s http://rcc.work:3143/pip.conf > ~/.pip/pip.conf

apt-get -y install python3 python3-pip
pip3 install --break-system-packages jupyterlab
jupyter lab --generate-config
from jupyter_server.auth import passwd; passwd()

# jupyter-lab --ip=* --allow-root

###### R
apt-get -y install r-base gdebi
curl -O http://rcc.work:3143/rstudio-server-2023.12.0-369-amd64.deb
curl -O http://rcc.work:3143/libssl1.1_1.1.1w-0+deb11u1_amd64.deb 
dpkg -i libssl1.1_1.1.1w-0+deb11u1_amd64.deb 
gdebi rstudio-server-2023.12.0-369-amd64.deb


export LD_LIBRARY_PATH = /usr/lib64/x86_64-linux-gnu/:$LD_LIBRARY_PATH


## DB
sudo docker rm -f db
sudo docker run -it --name db --restart always --network work --net=host debian

echo 'Acquire::http::Proxy "http://rcc.work:3142";' > /etc/apt/apt.conf
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime 
apt-get -y update && apt-get -y upgrade
apt-get -y install apt-utils dialog curl nano sudo procps
apt-get -y install postgresql

echo 'cd /root' >> ~/.bashrc
echo 'service postgresql start' >> ~/.bashrc
echo '/root/postgrest /root/postgrest.conf &' >> ~/.bashrc

echo 'db-uri = "postgres://postgres:postgres@localhost:5432/postgres"' > /root/postgrest.conf
echo 'db-schema = "db"' >> /root/postgrest.conf
echo 'db-anon-role = "postgres"' >> /root/postgrest.conf

###
sudo -i -u postgres psql postgres
\password postgres

create schema db;
create table db.stock_list();
alter table db.stock_list add name text;
alter table db.stock_list add market text;
insert into db.stock_list (name,  market) values ('IBM',  'NYSE');
insert into db.stock_list (name,  market) values ('PFE',  'NYSE');

create table db.stock_trend();
alter table db.stock_trend add name text;
alter table db.stock_trend add date date;
alter table db.stock_trend add price double precision;