LoginSignup
0
0

More than 5 years have passed since last update.

The infrastructure engineer tried making web service (without paying) for just the momentum.

Posted at

This article is an automatic translation of the article[fa9dd70024865bff90f0] below.
https://qiita.com/speaktech/items/fa9dd70024865bff90f0

Introduction

As an infrastructure engineer I thought"I want to make such a service"
(Truly) We will share footprints that completed Web services momentarily.
I would be pleased if you could help others coming up with momentum just like me.

Services I wanted to make

A LINE application that automatically albums images posted in a line group.

I will return to"Tsukkomi"as"Tempuraenba yeah!"
I would like you to automatically create an album while leaving an exquisite flow brought up within the group.
To Tsukkomi"I can not look back at the image in the group as it is!"I will return"It is immediate shelf life". I want you to save it automatically after all.

Well then, where to save?
Google Drive right? There is not anyone who does not have a Google account, so please save it to your Google Drive.

Confirm feasibility

Once the idea settled down, I broke down ideas by technology elements.

  1. Infrastructure
  2. Middleware
  3. Programming language
  4. Cooperation between LINE and applications
  5. Collaboration between Google and applications

For 1 and 2, by using PaaS called Heroku, middleware package management etc.
I decided to skip the trouble of operation.
For 3, I decided to use PHP that I had been involved in the operation of WEB server.
Up to this point so close to the core business that there was no hesitation, but the problem was from here.

Regarding 4 and 5, since it was an unknown area, I read and read a technical document in a rabbit.
As a result, by using OAuth 2 authentication
I understand that cooperation with each service is possible, I gave goin to myself.

What you used (memo)

Below, I will make a note of the technical elements used to realize the service.
I will also include a link for helpful articles.

· Heroku
PaaS operated by salesforce. Just by placing the program, you can manage the web service without being conscious of the infrastructure. By adding add-ons, you can add as many convenient functions as you need.
Even with the Free plan, it was possible to run 1000 hours (= 41.6 days)/month for each authentication account, and since the add-on also has a free limit, I used it.

(Information referred to)
Heroku command · setting memo memo
https://qiita.com/pugiemonn/items/0e69b7a29a384b356e65

· Heroku Postgres
Addons that can use PostgreSQL dedicated to Heroku applications.

(Free plan)
Number of rows: 10,000
Number of concurrent connections: 20
Downtime per month: Up to 4 hours
Access via Heroku CLI
PGBackups: Hold up to 2
Dataclips
Rollback: 0 seconds

(Information referred to)
How to connect to database (PostgreSQL) with Heroku
https://qiita.com/shikatani/items/c7af30b98c2d0419d7af

· MemCachier
Add-on that can use session storage as SaaS.

(Free plan)
Connection Limit: 10
Proxy Servers: 1
Bucket Size: 25 MB

(Information referred to)
Save session information in memcached with Heroku + PHP
https://qiita.com/shin1x1/items/df2ddb3cc7bfd3f58e67

· SendGrid
Add-on that can use mail server as SaaS.

(Free plan)
Emails per Month: Up To 12000 (Free up to 12,000 mails/month)

(Information referred to)
How to send e-mail with sendgrid-php attached image attached
https://naughtldy.hatenablog.jp/entry/2017/04/07/080000

· Papertrail
Log management/monitoring add-on. It is also possible to notify you of e-mails when detecting any word.

(Information referred to)
Introducing & using log management tool"papertrail"on Heroku
http://vdeep.net/heroku-papertrail

· PHP

· OAuth 2 client (league/oauth 2 - client)
Without relying on authentication destinations such as Google, Facebook, etc., you can use OAuth 2 linkage code
OAuth 2 exclusive client that can be written uniformly.

(Information referred to)
Easily OAu with PHPA sample that implements th authentication (eg GitHub login)
https://qiita.com/ikuwow/items/bd96f0dcaeab65edb642

· LINE Messaging API
API for using LINE @ as a bot.

(Information referred to)
line/line-bot-sdk-php
https://github.com/line/line-bot-sdk-php

· Google Drive API
An API that allows you to read and write files to Google Drive. By having users collaborate with OAuth 2, acquiring an access token, it is also possible to operate the user's Google Drive.

(Information referred to)
Try using GoogeDriveAPI with PHP (1)
http://challenge.no1s.biz/programming/php/392

· Logaster
A service that generates such a logo from the service name.
There is no design sense, I do not care about that, but it is recommended for troubled men who want something like that.

(Information referred to)
How to create a logo online with Logaster in minutes
https://webtan.impress.co.jp/u/2018/04/11/28950

Conceptual diagram of service

image.png

In order to leave the UI to LIINE, the user will interact with the LINE bot to exchange messages and images.
From LINE to Heroku Information sent by the user as a post request will be sent.
Analyze the request with the PHP application and decide the action.

For example, if a user asks for cooperation with a Google Account through a LINE bot, we will guide you to the URL of Google's OAuth authentication screen. If the user succeeds in OAuth authentication, redirects to Heroku, gets the access token to Google Drive, and stores it in PostgreSQL.

When an image is sent from the user through the LINE bot, it will be automatically saved to the user's Google Drive only if you already have the access token.

What can be done

1 _ Primary_logo_on_transparent_ 213 x 67.png

DriveUP
https://driveup.herokuapp.com/en/index.php

DriveUP sends images you post in the LINE group to your Google Drive
It is a LINE application to save automatically.

Simply save DriveUP to your Google Drive simply by"adding friends"and making them"join"in the LINE group just like your friend's account.

Impressions

With the wisdom of the great forerunners, I managed to shape it (I did not pay for one).
I thought that shaping ideas after all turned brainstorming groupgrill and feeling was good.
More than anything, I was happy when my friend gave me feedback. (Thank you)
(It is all immature) Idea is about to fall from the head,
I will continue to leave it in shape before it falls. Do not forget to brush up the shape though!

Thank you for reading until the end.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0