<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Public-Offering-Notice on</title><link>https://taetaetae.github.io/tags/public-offering-notice/</link><description>Recent content in Public-Offering-Notice on</description><generator>Hugo</generator><language>en</language><lastBuildDate>Sun, 04 Apr 2021 18:54:00 +0900</lastBuildDate><atom:link href="https://taetaetae.github.io/tags/public-offering-notice/index.xml" rel="self" type="application/rss+xml"/><item><title>공모주 알리미 개발 후기 - 3부</title><link>https://taetaetae.github.io/posts/public-offering-notice-3/</link><pubDate>Sun, 04 Apr 2021 18:54:00 +0900</pubDate><guid>https://taetaetae.github.io/posts/public-offering-notice-3/</guid><description>&lt;p>　﻿&lt;a href="https://t.me/PublicOfferingNotice" target="_blank" rel="noopener noreffer ">공모주 알리미&lt;/a>라는 토이 프로젝트 개발기의 마지막 포스팅이다. 토이 프로젝트를 왜 시작하게 되었고 어떻게 설계하게 되었으며 데이터는 어떤 식으로 수집하고 그 데이터를 어떤 방법으로 사용자들에게 알림을 보내기까지 알아보았다. 이제는 이러한 일련의 &amp;lsquo;파이프라인&amp;rsquo;을 자동화해야 할 시간이다. 사람이 직접 수동으로 로컬 컴퓨터에서 위 파이프라인을 실행하는 것이 아니라 별도의 서버에 해당 애플리케이션이 등록되어 있고 이를 어떤 무언가에 의해 트리거링을 해주는 방식으로 말이다.﻿&lt;/p>
&lt;ul>
&lt;li>1부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-1" rel="">프로젝트 설계, 데이터 수집&lt;/a>&lt;/li>
&lt;li>2부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-2" rel="">수집한 데이터 알림 발송&lt;/a>&lt;/li>
&lt;li>3부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-3" rel="">서버 선정 및 릴리즈&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="서버-선정">서버 선정&lt;/h2>
&lt;p>　﻿1부에서 이야기했던 것처럼 &lt;a href="https://www.heroku.com" target="_blank" rel="noopener noreffer ">heroku&lt;/a>라는 PaaS(Platform as a service)를 사용하면 될 것 같았다. 무료 플랜으로도 설계했던 서비스 내용을 모두 소화 가능했기 때문이다. 앞서 만든 Spring Boot Application 을 heroku에 배포를 해보자.&lt;/p>
&lt;p>　heroku에서 새로운 &amp;lsquo;App&amp;rsquo;을 생성한다. 아래에서 보여주고 있는 화면대로 App name을 지정하고 만들기만 하면 끝. 그러면 배포 방법이 여러 가지가 나오는데 heroku에서 제공하는 CLI를 사용하는 방법, 그리고 Github 과 연동하거나, 컨테이너 레지스트리를 활용하는 방법 총 3가지가 있다. 여기서 필자는 Github을 활용해서 연동하는 방법을 소개해 보고자 한다.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-3/1.jpg" title="/images/public-offering-notice-3/1.jpg" data-thumbnail="/images/public-offering-notice-3/1.jpg" data-sub-html="&lt;h2>heroku 에서 app을 생성하자.&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-3/1.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-3/1.jpg, https://taetaetae.github.io/images/public-offering-notice-3/1.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-3/1.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-3/1.jpg" />
 &lt;/a>&lt;figcaption class="image-caption">heroku 에서 app을 생성하자.&lt;/figcaption>
 &lt;/figure>
&lt;p>　﻿로컬에서 만든 애플리케이션을 Github에 push 하면 Github Repository 가 생기고 작업 파일들이 정상적으로 업로드된 것을 확인할 수 있다. 그다음 heroku에서 만들었던 App 페이지에서 Deploy 탭을 클릭하면 아래와 같이 3가지 방법으로 Deploy를 할 수 있다고 나오고, 이 중에 &amp;ldquo;Connect to Github&amp;quot;을 선택하면 Github 과 연동할 수 있는 버튼이 생기고 이를 누르면 자동으로 본인의 Github 내 Repository를 등록할 수 있도록 화면이 바뀐다.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-3/2.jpg" title="/images/public-offering-notice-3/2.jpg" data-thumbnail="/images/public-offering-notice-3/2.jpg" data-sub-html="&lt;h2>heroku 와 github 연동&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-3/2.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-3/2.jpg, https://taetaetae.github.io/images/public-offering-notice-3/2.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-3/2.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-3/2.jpg" />
 &lt;/a>&lt;figcaption class="image-caption">heroku 와 github 연동&lt;/figcaption>
 &lt;/figure>
&lt;p>　﻿그다음 위에서 Github에 push 했던 Repository 이름을 적고 검색하면 조회가 되고 &amp;lsquo;Connect&amp;rsquo;를 누르면 자동으로 연결이 된 것을 확인할 수 있다. 연동된 Repository 브랜치에 코드가 푸시 되면 자동으로 heroku에 배포가 되도록 자동화 설정도 가능하고 그 아래에 보면 브랜치를 선택해서 배포를 수동으로 할 수 있기도 하다. 수동으로 푸시를 눌러보면 이런저런 빌드 로그가 나오고 최종적으로 배포가 되어 &lt;code>{Appname}.herokuapp.com&lt;/code> 을 접속해보면 서버에 배포가 되어있는 것을 확인할 수 있다.&lt;/p>
&lt;ul>
&lt;li>sample Github Code : &lt;a href="https://github.com/taetaetae/heroku/blob/master/src/main/java/com/taetaetae/helloworld/heroku/HelloWorldController.java#L11" target="_blank" rel="noopener noreffer ">taetaetae@heroku#HelloWorldController.java#L11&lt;/a>&lt;/li>
&lt;li>sample heroku app : &lt;a href="https://taetaetae-test.herokuapp.com/" target="_blank" rel="noopener noreffer ">https://taetaetae-test.herokuapp.com/&lt;/a>&lt;/li>
&lt;/ul>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-3/3.jpg" title="/images/public-offering-notice-3/3.jpg" data-thumbnail="/images/public-offering-notice-3/3.jpg" data-sub-html="&lt;h2>수동으로 배포를 해보자.&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-3/3.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-3/3.jpg, https://taetaetae.github.io/images/public-offering-notice-3/3.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-3/3.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-3/3.jpg" />
 &lt;/a>&lt;figcaption class="image-caption">수동으로 배포를 해보자.&lt;/figcaption>
 &lt;/figure>
&lt;p>　﻿heroku에서는 이렇게 몇 번의 클릭만으로 간단하게 애플리케이션을 배포할 수 있는 기능을 제공하고 있고 서버 내 로그도 아래 화면처럼 보여주고 있기 때문에 쉽고 간단하게 서버를 구성하고 싶은 사용자들에게 매력적으로 보이는 것 같다. 단, 무료 플랜의 제한사항들을 자세히 살펴보고 사용할 것을 추천한다.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-3/4.jpg" title="/images/public-offering-notice-3/4.jpg" data-thumbnail="/images/public-offering-notice-3/4.jpg" data-sub-html="&lt;h2>서버 로그도 볼 수 있다!&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-3/4.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-3/4.jpg, https://taetaetae.github.io/images/public-offering-notice-3/4.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-3/4.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-3/4.jpg" />
 &lt;/a>&lt;figcaption class="image-caption">서버 로그도 볼 수 있다!&lt;/figcaption>
 &lt;/figure>
&lt;h2 id="호출-테스트-문제의-시작">호출 테스트, 문제의 시작&lt;/h2>
&lt;p>　﻿앞서 만들었던 텔레그램 채널에는 아무도 가입을 하지 않았기에 배포한 heroku web endpoint를 호출하면 텔레그램 봇을 통해 알림이 오는 걸 테스트하고 싶었다. 그런데 아무리 호출을 해도 서버는 타임아웃이라는 에러 응답을 뱉기 일쑤였고, 로직이 문제인지 한참을 리팩토링하며 원인을 파악하는데 꽤 오랜 시간을 삽질하였다. 왜 타임아웃이 발생할까? heroku는 web에서 바로 실행할 수 있는 console 페이지를 제공하고 있었다. 그래서 &amp;lsquo;크롤링을 하기 위한 페이지&amp;rsquo;와 &amp;lsquo;구글&amp;rsquo;을 비교하기 위해 단순하게 curl 해서 가져오는 테스트를 해보니 아래처럼 확연히 결과가 달랐다. 결국은 heroku 와 크롤링 하는 서버 간의 네트워크 타임아웃이 문제였던 것.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-3/5.jpg" title="/images/public-offering-notice-3/5.jpg" data-thumbnail="/images/public-offering-notice-3/5.jpg" data-sub-html="&lt;h2>오류가 나고 원인을 찾는 과정이 가장 어려운 것 같다. 어플리케이션의 문제가 아닌 네트워크 자체의 문제&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-3/5.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-3/5.jpg, https://taetaetae.github.io/images/public-offering-notice-3/5.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-3/5.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-3/5.jpg" />
 &lt;/a>&lt;figcaption class="image-caption">오류가 나고 원인을 찾는 과정이 가장 어려운 것 같다. 어플리케이션의 문제가 아닌 네트워크 자체의 문제&lt;/figcaption>
 &lt;/figure>
&lt;h2 id="그래서-어떻게-해결-했나">그래서 어떻게 해결 했나?&lt;/h2>
&lt;p>　﻿heroku에서 타임아웃이 발생하는 문제를 해결하려 여러 구글링을 통해 찾아봤지만 방법을 찾을 수 없어서 결국 heroku를 사용하는 것을 포기하고 다른 방법을 찾아봐야만 했다. 앞서 이야기했지만 토이 프로젝트를 무료로 운영하고 싶었기 때문에 이런저런 방법을 찾다 보니 AWS 와 비슷하게 Google에서도 GCP라는 서비스를 알게 되었다. 이곳에서도 1년 동안은 무료이지만 이후 AWS처럼 과금이 드는 문제가 아쉬워서 좀 더 찾아보니 아주 작은 서버에 특정 조건을 맞춘다면 평생 무료로 사용이 가능하다는 걸 알게 되었고 이를 사용하기로 마음먹는다. (참고 사이트 : &lt;a href="https://nhj12311.tistory.com/317" target="_blank" rel="noopener noreffer ">https://nhj12311.tistory.com/317&lt;/a>)﻿&lt;/p></description></item><item><title>공모주 알리미 개발 후기 - 2부</title><link>https://taetaetae.github.io/posts/public-offering-notice-2/</link><pubDate>Sun, 28 Mar 2021 11:41:33 +0900</pubDate><guid>https://taetaetae.github.io/posts/public-offering-notice-2/</guid><description>&lt;p>　﻿혹시 이 포스트를 처음 읽는 독자라면 &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-1" rel="">지난 포스팅&lt;/a>을 읽고 오는 것을 추천한다. 정리하자면, 지난 포스트에서는 &lt;a href="https://t.me/PublicOfferingNotice" target="_blank" rel="noopener noreffer ">토이 프로젝트&lt;/a>를 시작하게 된 계기와, 어떤 식으로 만들지에 대한 설계. 그리고 데이터를 수집하는 과정에 대해 이야기했었다. 지난 포스팅에서 수집한 데이터를 이제 사용자들에게 알려주는 부분에 대해 정리하고자 한다.&lt;/p>
&lt;ul>
&lt;li>1부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-1" rel="">프로젝트 설계, 데이터 수집&lt;/a>&lt;/li>
&lt;li>2부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-2" rel="">수집한 데이터 알림 발송&lt;/a>&lt;/li>
&lt;li>3부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-3" rel="">서버 선정 및 릴리즈&lt;/a>&lt;/li>
&lt;/ul>
&lt;h2 id="데이터-정의">데이터 정의&lt;/h2>
&lt;p>　﻿java 라이브러리 중에 jsoup라는 것을 사용하여 웹사이트를 크롤링 하였고, 필요한 데이터를 파싱을 하였다. 아래는 &amp;lsquo;공모주&amp;rsquo;라는 자바 모델을 정의해 보았다. 이렇게 자바 &amp;lsquo;모델&amp;rsquo;로 정의를 하는 이유는 필요한 데이터가 무엇인지 다시 한번 정리를 하기 위함이기도 하고 map 같은 형태의 임시 변수(?)보다 더 직관적이기에 이후 코드를 작성하는데 가이드 역할의 효과도 얻을 수 있을 것 같았기 때문이다.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-java" data-lang="java">&lt;span class="line">&lt;span class="cl">&lt;span class="kd">public&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="kd">class&lt;/span> &lt;span class="nc">PublicOffering&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="p">{&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">name&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 종목명&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">LocalDate&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">startDate&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 일정 시작일&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">LocalDate&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">endDate&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 일정 마감일&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">LocalDate&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">listingDate&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 상장일&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">publicOfferingPrice&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 확정 공모가&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">expectedOfferingPrice&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 희망 공모가&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">List&lt;/span>&lt;span class="o">&amp;lt;&lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="o">&amp;gt;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">Underwriter&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 주간사&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">detailUrl&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 상세URL&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w"> &lt;/span>&lt;span class="kd">private&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">String&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="n">competitionRate&lt;/span>&lt;span class="p">;&lt;/span>&lt;span class="w"> &lt;/span>&lt;span class="c1">// 청약경쟁률&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="w">&lt;/span>&lt;span class="p">}&lt;/span>&lt;span class="w">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>　﻿초기에는 위에서 정의한 모델처럼 공모주의 기본 정보만을 서비스해야겠다 생각했고, 관련 뉴스라든지 기타 추가적인 정보나 다른 분들의 요구 사항(?)들이 추가될 경우 점진적으로 설계를 하고서 확장시켜 나가는 방향으로 계획했다. 우선은 기능들이 부족하더라고 돌아가는 서비스를 만들고 싶었기에.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-2/agile.png" title="/images/public-offering-notice-2/agile.png" data-thumbnail="/images/public-offering-notice-2/agile.png" data-sub-html="&lt;h2>애자일 방법론! 출처 : https://m.blog.naver.com/keycosmos3/221267522930&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-2/agile.png"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-2/agile.png, https://taetaetae.github.io/images/public-offering-notice-2/agile.png 1.5x, https://taetaetae.github.io/images/public-offering-notice-2/agile.png 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-2/agile.png" />
 &lt;/a>&lt;figcaption class="image-caption">애자일 방법론!&lt;br> 출처 : &lt;a href="https://m.blog.naver.com/keycosmos3/221267522930" target="_blank" rel="noopener noreffer ">https://m.blog.naver.com/keycosmos3/221267522930&lt;/a>&lt;/figcaption>
 &lt;/figure>
&lt;h2 id="텔레그램-봇채널-생성">텔레그램 봇/채널 생성&lt;/h2>
&lt;p>　﻿텔레그램 봇을 만드는 과정은 가볍게 검색을 해보면 너무나 쉽게 찾을 수 있지만, 보다 하나의 글 안에 모든 내용을 담고 싶어 텔레그램 봇을 만들고 → 텔레그램 채널을 만든 다음 → 텔레그램 봇을 이용해서 텔레그램 채널에 메시지를 보내는 걸 이야기해 보고자 한다.&lt;/p>
&lt;blockquote>
&lt;p>﻿아, 여기서 왜 꼭 &amp;lsquo;텔레그램&amp;rsquo;을 선택했는가에 대한 이유는 개인적으로 다른 메신저 (카카오톡, 라인 등)보다도 api를 활용하여 메시지를 보내는 과정이 단순하면서도 빠르고 쉽게 느껴졌기 때문이다. 혹시 텔레그램 이 아닌 다른 메신저로 보내달라는 요청이 있을 경우 그때 가서 고민해 보려 한다.&lt;/p>&lt;/blockquote>
&lt;ul>
&lt;li>텔레그램 봇 생성&lt;/li>
&lt;/ul>
&lt;p>　﻿먼저 텔레그램 메신저에서 &amp;lsquo;BotFather&amp;rsquo;라는 사용자를 찾고 &amp;lsquo;/start&amp;rsquo;를 누르면 아래와 같이 사용할 수 있는 명령어가 나온다.&lt;/p>
&lt;p>　﻿그다음 우리는 봇을 만들 것이기 때문에 &amp;lsquo;/newbot&amp;rsquo;을 누르고 봇의 이름을 작성하고 그 봇의 사용자 이름을 지정한다. &amp;lsquo;_bot&amp;rsquo;으로 끝나야 한다고 하기에 이름 뒤에 붙여서 만들면 그걸로 끝. 다음으로 친절하게 HTTP API를 사용할 수 있는 토큰이 발급되는데 이 토큰으로 봇을 컨트롤 가능하기 때문에 잘 간직하고(?) 있어야 한다.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-2/newbot.jpg" title="/images/public-offering-notice-2/newbot.jpg" data-thumbnail="/images/public-offering-notice-2/newbot.jpg" data-sub-html="&lt;h2>친절한 봇 아버지&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-2/newbot.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-2/newbot.jpg, https://taetaetae.github.io/images/public-offering-notice-2/newbot.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-2/newbot.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-2/newbot.jpg" width="70%" />
 &lt;/a>&lt;figcaption class="image-caption">친절한 봇 아버지&lt;/figcaption>
 &lt;/figure>
&lt;p>　﻿이후 해당 토큰을 이용해서 봇의 상태를 확인해보자. 아래의 url에 토큰 경로만 변경하여 입력하면 json 응답을 받을 수 있다.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-markdown" data-lang="markdown">&lt;span class="line">&lt;span class="cl">https://api.telegram.org/bot{token}/getUpdates
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">e.g. https://api.telegram.org/bot17...42:AAH...cQU/getUpdates
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ul>
&lt;li>텔레그램 채널 생성&lt;/li>
&lt;/ul>
&lt;p>　﻿1:N으로 채널에 가입한 사람들에게 메시지를 일방적으로 보내야 하기 때문에 사용할 채널을 만들어 보자. 텔레그램 UI만 봐도 간단하게 생성하기 쉽게 되어있다. 더불어 이 채널에 메시지를 보내야 하기 때문에 위에서 만들었던 봇을 추가하고 관리자로 승격 시키자.&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-2/newchannel.jpg" title="/images/public-offering-notice-2/newchannel.jpg" data-thumbnail="/images/public-offering-notice-2/newchannel.jpg" data-sub-html="&lt;h2>채널 생성 &amp;gt; 봇을 관리자로&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-2/newchannel.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-2/newchannel.jpg, https://taetaetae.github.io/images/public-offering-notice-2/newchannel.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-2/newchannel.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-2/newchannel.jpg" width="70%" />
 &lt;/a>&lt;figcaption class="image-caption">채널 생성 &amp;gt; 봇을 관리자로&lt;/figcaption>
 &lt;/figure>
&lt;ul>
&lt;li>﻿텔레그램 봇으로 텔레그램 채널에 메시지 보내기&lt;/li>
&lt;/ul>
&lt;p>　이 부분에서 약간 헤맸는데 결국 위에서 얻은 토큰과 채널의 특정 id를 알아야 메시지를 보낼 수 있다. 앞서 만들었던 채널에 아무 메시지나 작성을 하고 위에서 호출했던 &amp;lsquo;getUpdates&amp;rsquo; api를 다시 호출해보면 아래처럼 채널의 id를 구할 수 있게 된다.&lt;/p></description></item><item><title>공모주 알리미 개발 후기 - 1부</title><link>https://taetaetae.github.io/posts/public-offering-notice-1/</link><pubDate>Sun, 21 Mar 2021 19:13:49 +0900</pubDate><guid>https://taetaetae.github.io/posts/public-offering-notice-1/</guid><description>&lt;p>　﻿작년부터 시작된 &amp;lsquo;동학 개미 운동&amp;rsquo;에 언제부터인가 필자도 주린이로써 동참을 하게 되었다. 최근에는 &amp;lsquo;공모주 청약&amp;rsquo;이라는 걸 알게 되었는데 따라 해보고 정신 차려보니 치킨 한 마리 정도의 수익을 얻는 기적이 일어났다. 공모주란 정해진 일자에 청약을 하고 배정을 받으면 해당 주식이 상장을 하기 전에 미리 살 수 있다는 &amp;lsquo;기회&amp;rsquo;로 이해했다. (주린이라 이해의 범위가 여기까지다&amp;hellip;) 공모주 배정이 로또처럼 엄청난 큰 수익률을 가져다주는 건 아니지만 앞서 이야기 한 것처럼 언제 있을지 모르는 공모주 청약을 꼬박꼬박 챙겨서 하게 된다면 맛있는 치킨을 먹을 수 있겠다는 기대감이 부풀었다. (치킨은 역시 교촌 허니콤보&amp;hellip;)&lt;/p>
&lt;figure>&lt;a class="lightgallery" href="https://taetaetae.github.io/images/public-offering-notice-1/stock.jpg" title="/images/public-offering-notice-1/stock.jpg" data-thumbnail="/images/public-offering-notice-1/stock.jpg" data-sub-html="&lt;h2>주린이는 계속 자야 할까 싶다. 출처 : https://b-s-d.tistory.com/8&lt;/h2>">
 &lt;img
 class="lazyload"
 src="https://taetaetae.github.io/svg/loading.min.svg"
 data-src="https://taetaetae.github.io/images/public-offering-notice-1/stock.jpg"
 data-srcset="https://taetaetae.github.io/images/public-offering-notice-1/stock.jpg, https://taetaetae.github.io/images/public-offering-notice-1/stock.jpg 1.5x, https://taetaetae.github.io/images/public-offering-notice-1/stock.jpg 2x"
 data-sizes="auto"
 alt="/images/public-offering-notice-1/stock.jpg" width="50%" />
 &lt;/a>&lt;figcaption class="image-caption">주린이는 계속 자야 할까 싶다.&lt;br> 출처 : &lt;a href="https://b-s-d.tistory.com/8" target="_blank" rel="noopener noreffer ">https://b-s-d.tistory.com/8&lt;/a>&lt;/figcaption>
 &lt;/figure>
&lt;p>　﻿치킨이 머릿속에 맴도는 시간도 잠시. 필자의 머리를 스치는 하나의 생각. 그러면 공모주 청약은 언제 하는 거지? 청약하니까 준비하라고 누가 알려주면 좋을 텐데&amp;hellip; 그러면서 이런저런 검색을 해보니 안드로이드 앱은 이미 있었고, IOS 앱은 없었다. 음? 그럼 이걸 내가 만들어보면 어떨까?&lt;/p>
&lt;p>　﻿결론부터 말하자면, 텔레그램을 활용하여 자동화 공모주 알림봇을 만들게 되었다. 혹시 공모주에 관심이 있다면 필자가 만든 &lt;a href="https://t.me/PublicOfferingNotice" target="_blank" rel="noopener noreffer ">텔레그램 채널&lt;/a>을 가입하는 것도 좋을 것 같다.﻿&lt;/p>
&lt;p>　﻿이번 글에서는 필자의 새로운 토이 프로젝트인 &amp;lsquo;공모주 알리미&amp;rsquo;를 만들게 된 배경과 설계, 그리고 개발부터 릴리즈까지에 대해 이야기를 해보고자 한다. 크게 아래의 목차로 이야기하게 될 것 같다.&lt;/p>
&lt;ul>
&lt;li>1부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-1" rel="">프로젝트 설계, 데이터 수집&lt;/a>&lt;/li>
&lt;li>2부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-2" rel="">수집한 데이터 알림 발송&lt;/a>&lt;/li>
&lt;li>3부 : &lt;a href="https://taetaetae.github.io/posts/public-offering-notice-3" rel="">서버 선정 및 릴리즈&lt;/a>&lt;/li>
&lt;/ul>
&lt;p>　﻿자칫 너무 간단한데~, 이런 걸 굳이 왜 만들어?라는 시각이 있을 수 있겠지만 토이 프로젝트를 해야지 하고 마음을 먹었지만 막상 시작을 못하고 있는 어느 누군가에게는 도움이 될 내용인 것 같아서 꽤 자세히 정리를 하려 한다. 물론 이러한 정리는 필자 자신을 위해서가 더 크긴 하다.&lt;/p>
&lt;h2 id="프로젝트-설계">프로젝트 설계&lt;/h2>
&lt;p>　﻿과거에 토이 프로젝트로 진행했던 &lt;a href="http://daily-devblog.com/" target="_blank" rel="noopener noreffer ">기술블로그 구독 서비스&lt;/a>의 경험을 되새기면서 처음부터 황소처럼 달려드는 것보단 충분에 충족을 더해 충만해질 때까지 고민을 오랫동안 해보기로 했다. (그래봤자 하루 정도&amp;hellip;?^^)
　﻿
우선 데이터를 어딘가에서 가져오고 가져온 데이터를 DB에 저장할 것인지 아니면 저장하지 않고 휘발성으로 조회후 버리는(?) 형태로 할 것인지를 고민해야 했다. 공모주라는 데이터의 특성상 한번 정해진 메타 데이터가 상황에 따라 변경이 될 수도 있다고 했기에(일정이 변경되거나 공모가가 변경되거나 등) DB에 저장을 하게 되면 이를 동기화(Sync) 하는 비용이 추가로 생길 것 같아서 알림을 보내기 직전에만 조회하고 버리는 형태를 생각했다.&lt;/p>
&lt;p>　그렇게 데이터를 조회했다면 이를 입맛에 맞게 가공하고서 사용자에게 알림을 줘야 한다. 알림을 발생시키는 방법은 매우 다양한데 뭔가 적은 비용으로 구성하고 싶었다. 즉, 알림을 받는 사용자가 10명, 100명, 1000명 이 되어도 (그렇게 될지는 모르겠지만;;) 내가 만든 서비스에서 알림 수신인이 늘어나는 경우를 고려하지 않아도 되었으면 했다. 그에 생각한 게 메신저 API. 그중에서도 텔레그램 API가 뭔가 이런 형식으로 딱일 것 같았기 때문이다. 결국 데이터를 메시지 형태에 맞춰 한 번만 발송하게 되면 1:N 형식(Broadcast)으로 텔레그램 채널을 구독하고 있는 사용자들에게 전송이 될 테니 안성맞춤이었다.&lt;/p>
&lt;p>　그럼 언제 어떤 정보를 알려주는 게 좋을까? 청약이 보통 오전에 시작하기 때문에 대략 매일 오전 9시에 관련 정보들을 보내주면 될 것 같았다. 3일 전에 청약을 시작하게 되니 미리 준비하라는 알림. 그리고 청약 날짜가 도래해서 잊지 말고 청약을 신청하라는 알림. 마지막으로 공모주가 상장을 하게 되는 알림. 이 세 가지 알림만 잘 챙긴다면 필자 같은 주린이들도 충분히 공모주 청약으로 치킨을 먹을 수 있을 거라 생각했다.&lt;/p>
&lt;p>　마지막으로 이 모든 내용을 개발한 어플리케이션을 어느 곳에 배포해야 하는지를 결정해야 했다. 항상 머릿속에는 있었지만 한 번도 안 해본 클라우드 Paas 인 &lt;a href="https://dashboard.heroku.com/" target="_blank" rel="noopener noreffer ">heroku&lt;/a>가 딱일 거라 생각했다. (실제로 해보지 않았던 지금까지는 그랬다&amp;hellip;) 다들 토이 프로젝트 서버로 잘 활용한다는 소리를 들었고 가장 큰 장점은 &amp;lsquo;무료&amp;rsquo;라는 점에서 heroku를 선택하지 않을 수 없었다.&lt;/p></description></item></channel></rss>