'2020/09'에 해당되는 글 8건

  1. 2020.09.23 mongodb 설정
  2. 2020.09.21 sample-axios
  3. 2020.09.20 Springboot mongodb 연동
  4. 2020.09.18 ngrok 설정
  5. 2020.09.11 React 01
  6. 2020.09.06 Springboot Docker Image
  7. 2020.09.05 Docker MySQL
  8. 2020.09.04 OSX OpenJDK 설치

mongodb 설정

2020. 9. 23. 22:13 from Development Log
mongo -u [user] -p [password]
db.createUser({user: "photo-manage", pwd: "password", roles:["readWrite", "userAdmin"]})

 

'Development Log' 카테고리의 다른 글

start Django  (0) 2020.11.01
sample-axios  (0) 2020.09.21
Springboot mongodb 연동  (0) 2020.09.20
ngrok 설정  (0) 2020.09.18
React 01  (0) 2020.09.11
Posted by NuBiFoRM :

sample-axios

2020. 9. 21. 21:34 from Development Log
% npm install -g create-react app
+ create-react@0.0.0
+ app@0.1.0
added 54 packages from 28 contributors in 4.411s
% create-react-app sample-axios

Creating a new React app in /Users/nubiform/react/sample-axios.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


> fsevents@1.2.13 install /Users/nubiform/react/sample-axios/node_modules/jest-haste-map/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.13 install /Users/nubiform/react/sample-axios/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.13 install /Users/nubiform/react/sample-axios/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.11 postinstall /Users/nubiform/react/sample-axios/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.5 postinstall /Users/nubiform/react/sample-axios/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall /Users/nubiform/react/sample-axios/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ react@16.13.1
+ cra-template@1.0.3
+ react-dom@16.13.1
+ react-scripts@3.4.3
added 1605 packages from 757 contributors and audited 1605 packages in 50.387s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Initialized a git repository.

Installing template dependencies using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ @testing-library/user-event@7.2.1
+ @testing-library/react@9.5.0
+ @testing-library/jest-dom@4.2.4
added 36 packages from 57 contributors and audited 1641 packages in 11.268s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing template package using npm...

npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

removed 1 package and audited 1640 packages in 7.191s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Created git commit.

Success! Created sample-axios at /Users/nubiform/react/sample-axios
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd sample-axios
  npm start

Happy hacking!
% npm i axios
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ axios@0.20.0
added 1 package from 1 contributor and audited 1641 packages in 7.062s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
% npm i http-proxy-middleware
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ http-proxy-middleware@1.0.5
added 7 packages from 24 contributors, updated 1 package and audited 1648 packages in 8.292s

69 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
const { createProxyMiddleware } = require('http-proxy-middleware');
module.exports = function(app) {
  app.use(
    '/api',
    createProxyMiddleware({
      target: 'http://localhost:8081',
      changeOrigin: true,
    })
  );
};

'Development Log' 카테고리의 다른 글

start Django  (0) 2020.11.01
mongodb 설정  (0) 2020.09.23
Springboot mongodb 연동  (0) 2020.09.20
ngrok 설정  (0) 2020.09.18
React 01  (0) 2020.09.11
Posted by NuBiFoRM :

Springboot mongodb 연동

2020. 9. 20. 16:08 from Development Log

docker에 mongodb를 실행

 - mongodb.yml

version: '3.4'

services:
  mongo:
    image: mongo
    restart: always
    ports:
      - 27017:27017
    environment:
      MONGO_INITDB_ROOT_USERNAME: root
      MONGO_INITDB_ROOT_PASSWORD: root
    volumes:
      - [host_volume_path]:/data/db

  mongo-express:
    image: mongo-express
    restart: always
    ports:
      - 8081:8081
    environment:
      ME_CONFIG_MONGODB_ADMINUSERNAME: root
      ME_CONFIG_MONGODB_ADMINPASSWORD: root
% docker-compose -f mongodb.yml up -d

 

springboot project

 - pom.xml

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>

 

 - Images.java

import java.util.HashMap;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import lombok.Data;

@Data
@Document(collection = "images")
public class Images {
	@Id
	private String id;
	private String filename;
	private String originfilename;
	private HashMap<Object, HashMap<Object, Object>> metadata;
}

 

Service  구현

@Autowired
private MongoTemplate mongoTemplate;
Images images = new Images();
images.setFilename(uuidFileName);
images.setOriginfilename(fileName);
images.setMetadata(metadata);
mongoTemplate.insert(images);

 

Data 확인

{
    _id: ObjectId('5f66fabd5b489c6f988327f7'),
    filename: 'd3bde09d-621e-41db-835d-6df13a6c3f54.JPG',
    originfilename: '2018_04_04_0258.JPG',
    metadata: {
        'Exif Thumbnail': {
            'Resolution Unit': 'Inch',
            'Thumbnail Length': '10567 bytes',
            Compression: 'JPEG (old-style)',
            'Thumbnail Offset': '7620 bytes',
            'X Resolution': '350 dots per inch',
            'Y Resolution': '350 dots per inch'
        },
        Huffman: {
            'Number of Tables': '4 Huffman tables'
        },
        'File Type': {
            'Detected File Type Long Name': 'Joint Photographic Experts Group',
            'Detected File Type Name': 'JPEG',
            'Detected MIME Type': 'image/jpeg',
            'Expected File Name Extension': 'jpg'
        },
        JPEG: {
            'Component 3': 'Cr component: Quantization table 1, Sampling factors 1 horiz/1 vert',
            'Compression Type': 'Baseline',
            'Data Precision': '8 bits',
            'Number of Components': '3',
            'Component 2': 'Cb component: Quantization table 1, Sampling factors 1 horiz/1 vert',
            'Component 1': 'Y component: Quantization table 0, Sampling factors 2 horiz/1 vert',
            'Image Height': '4480 pixels',
            'Image Width': '6720 pixels'
        },
        Interoperability: {
            'Interoperability Version': '1.00',
            'Related Image Width': '6720',
            'Related Image Height': '4480',
            'Interoperability Index': 'Recommended Exif Interoperability Rules (ExifR98)'
        }
    },
    _class: 'com.nubiform.mongo.document.Images'
}

'Development Log' 카테고리의 다른 글

mongodb 설정  (0) 2020.09.23
sample-axios  (0) 2020.09.21
ngrok 설정  (0) 2020.09.18
React 01  (0) 2020.09.11
Springboot Docker Image  (0) 2020.09.06
Posted by NuBiFoRM :

ngrok 설정

2020. 9. 18. 17:07 from Development Log

ngrok 다운로드

ngrok.com/

 

아래 패스에 설치

/usr/local/bin

 

account 설정

% ngrok authtoken [account key]

 

80포트 연결

% ngrok http 80
ngrok by @inconshreveable                                                                                                                       (Ctrl+C to quit)
                                                                                                                                                                
Session Status                online                                                                                                                            
Account                       --------------- (Plan: Free)                                                                                                      
Version                       2.3.35                                                                                                                            
Region                        United States (us)                                                                                                                
Web Interface                 http://127.0.0.1:4040                                                                                                             
Forwarding                    http://------------.ngrok.io -> http://localhost:80                                                                               
Forwarding                    https://------------.ngrok.io -> http://localhost:80                                                                              
                                                                                                                                                                
Connections                   ttl     opn     rt1     rt5     p50     p90                                                                                       
                              1       0       0.00    0.00    60.64   60.64                                                                                     
                                                                                                                                                                
HTTP Requests                                                                                                                                                   
-------------                                                                                                                                                   
                                                                                                                                                                
GET /                          404

'Development Log' 카테고리의 다른 글

sample-axios  (0) 2020.09.21
Springboot mongodb 연동  (0) 2020.09.20
React 01  (0) 2020.09.11
Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
Posted by NuBiFoRM :

React 01

2020. 9. 11. 17:33 from Development Log

npm 설치

% brew install node

 

create-react-app 설치

% npm install -g create-react-app
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
+ create-react-app@3.4.1
added 98 packages from 46 contributors in 6.514s

 

개발환경 구축

% npm init -y create-react-app .

Creating a new React app in /Users/nubiform/react-app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...


> fsevents@1.2.13 install /Users/nubiform/react-app/node_modules/jest-haste-map/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.13 install /Users/nubiform/react-app/node_modules/watchpack-chokidar2/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> fsevents@1.2.13 install /Users/nubiform/react-app/node_modules/webpack-dev-server/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.11 postinstall /Users/nubiform/react-app/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.5 postinstall /Users/nubiform/react-app/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall /Users/nubiform/react-app/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

+ react-dom@16.13.1
+ cra-template@1.0.3
+ react-scripts@3.4.3
+ react@16.13.1
added 1593 packages from 755 contributors and audited 1593 packages in 98.023s

67 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Initialized a git repository.

Installing template dependencies using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ @testing-library/react@9.5.0
+ @testing-library/user-event@7.2.1
+ @testing-library/jest-dom@4.2.4
added 36 packages from 57 contributors and audited 1629 packages in 13.611s

67 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

Removing template package using npm...

npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

removed 1 package and audited 1628 packages in 6.154s

67 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


Created git commit.

Success! Created react-app at /Users/nubiform/react-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd /Users/nubiform/react-app
  npm start

Happy hacking!

 

실행

react-app % npm run start

Compiled successfully!

You can now view react-app in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://10.0.1.101:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

 

빌드

react-app % npm run build

> react-app@0.1.0 build /Users/nubiform/react-app
> react-scripts build

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  39.88 KB       build/static/js/2.e1eeb85d.chunk.js
  774 B          build/static/js/runtime-main.ec2d9410.js
  573 B (-27 B)  build/static/js/main.dc216b7d.chunk.js
  72 B           build/static/css/main.5facb584.chunk.css

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  npm install -g serve
  serve -s build

Find out more about deployment here:

  bit.ly/CRA-deploy

 

서버

react-app % npx serve -s build
npx: installed 78 in 3.457s

   ┌────────────────────────────────────────────────┐
   │                                                │
   │   Serving!                                     │
   │                                                │
   │   - Local:            http://localhost:5000    │
   │   - On Your Network:  http://10.0.1.101:5000   │
   │                                                │
   │   Copied local address to clipboard!           │
   │                                                │
   └────────────────────────────────────────────────┘

'Development Log' 카테고리의 다른 글

Springboot mongodb 연동  (0) 2020.09.20
ngrok 설정  (0) 2020.09.18
Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
OSX OpenJDK 설치  (0) 2020.09.04
Posted by NuBiFoRM :

Springboot Docker Image

2020. 9. 6. 20:49 from Development Log

Buildpacks

% ./mvnw spring-boot:build-image -Dspring-boot.build-image.imageName=myapp

 

Dokerfile

FROM openjdk:11-jre-slim
COPY ./MySpringBoot-0.0.1-SNAPSHOT.jar /usr/bin/myapp/myapp.jar
WORKDIR /usr/bin/myapp
ENTRYPOINT ["java", "-jar", "myapp.jar"]
% docker build -t myapp .

 

 

 

'Development Log' 카테고리의 다른 글

ngrok 설정  (0) 2020.09.18
React 01  (0) 2020.09.11
Docker MySQL  (0) 2020.09.05
OSX OpenJDK 설치  (0) 2020.09.04
April 16, 2013  (0) 2013.04.16
Posted by NuBiFoRM :

Docker MySQL

2020. 9. 5. 17:20 from Development Log

mysql 도커 이미지 다운로드

% docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
bf5952930446: Pull complete 
8254623a9871: Pull complete 
938e3e06dac4: Pull complete 
ea28ebf28884: Pull complete 
f3cef38785c2: Pull complete 
894f9792565a: Pull complete 
1d8a57523420: Pull complete 
6c676912929f: Pull complete 
3cdd8ff735c9: Pull complete 
4c70cbe51682: Pull complete 
e21cf0cb4dc3: Pull complete 
28c36cd3abcc: Pull complete 
Digest: sha256:6ded54eb1e5d048d8310321ba7b92587e9eadc83b519165b70bbe47e4046e76a
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest

 

도커 이미지 확인

% docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
mysql               latest              3646af3dc14a        13 hours ago        544MB

 

컨테이너 생성

% docker run -d --name mysqltest -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root mysql
bf0710b848ce8657971e3d27dfe29f09e2747b96f4d2decedf75410c2e7caad4
% docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                               NAMES
bf0710b848ce        mysql               "docker-entrypoint.s…"   16 seconds ago      Up 16 seconds       0.0.0.0:3306->3306/tcp, 33060/tcp   mysqltest

 

컨테이너 설정(Volume)

Docker -> Preferences... -> File Sharing.

% docker run -d --name mysqltest -p 3306:3306 -e MYSQL_ROOT_PASSWORD=root -v /Users/nubiform/docker/volumes/mysql:/var/lib/mysql mysql

 

컨테이너 접속

% docker exec -it mysqltest bash
root@bf0710b848ce:/# mysql -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.21 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

 

docker-compose

mysqltest.yml

version: '3'

services:
  mysqltest:
    image: mysql
    restart : always
    ports:
      - 3306:3306
    environment:
      MYSQL_ROOT_PASSWORD: root
    volumes:
      - /Users/nubiform/docker/volumes/mysql:/var/lib/mysql

 

실행

% docker-compose -f mysqltest.yml up -d

'Development Log' 카테고리의 다른 글

React 01  (0) 2020.09.11
Springboot Docker Image  (0) 2020.09.06
OSX OpenJDK 설치  (0) 2020.09.04
April 16, 2013  (0) 2013.04.16
May 16, 2011  (0) 2011.05.16
Posted by NuBiFoRM :

OSX OpenJDK 설치

2020. 9. 4. 20:12 from Development Log

Homebrew 설치

http://brew.sh/

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

 

OpenJDK 설치

http://github.com/AdoptOpenJDK/homebrew-openjdk

$ brew cask install adoptopenjdk
$ brew cask install adoptopenjdk14-openj9

'Development Log' 카테고리의 다른 글

Springboot Docker Image  (0) 2020.09.06
Docker MySQL  (0) 2020.09.05
April 16, 2013  (0) 2013.04.16
May 16, 2011  (0) 2011.05.16
청주버스 1.03.52 Release (April 29, 2011)  (0) 2011.05.02
Posted by NuBiFoRM :