This is a creation in Article, where the information may have evolved or changed.
Background
The story is this:
The company system has a service is pdf2jpg (actually should be ppt2jpg, just ppt2pdf This step we use seven cow cloud service to complete. In the early days, we used the crontab to get the data that the database needs to be converted periodically according to the system load. So the QPS of this service is 1/60 QPS. Yes, you do not see the wrong is so low, but it is OK, after all, the user capacity is not big.
But with the increase of user size, we have to face a problem: is how to meet the dynamic needs of user conversion (the user's demand outbreak of the general outbreak in the evening around 6 o'clock). Just seven of the UFOP can meet our needs. And there's a free quota.
内存 CPU 系统盘 按需¥/每小时 月计 M0C1 512MB 1 Core 10GB 0.088 63.36 M1C2 1GB 2 Core 10GB 0.176 126.72 M4C8 4GB 8 Core 10GB 0.650 468 M8C12 8GB 12 Core 10GB 1.300 936注意:M0C1的情况下,标准用户 和 高级用户 ,有 750 小时/月的免费额度。
Our plan is like this. Open only one m1c2 instance at leisure, and then open two M1C2 instances when busy. This ensures both effectiveness and economic performance.
Implement
Write seven cattle code, must not only look at the official website of the document, be sure to find their GitHub on the project Qiniu-ufop-go, Ufop-golang. But even if it's not all on GitHub, some of it is out of date.
As long as you remember this, then writing code is nothing!
Deployment
Many people think that the hardest code is written, so deployment should be a matter of minutes. Let's take a look at the following blood and tears chart.
The seven cows are using the Docker scheme, self-built update source, isolated the extranet link. So install a ImageMagick don't mention how much it hurts!
First need to install libpng, then install Ghostscript, and then install ImageMagick, but ImageMagick dead and alive can not find the path of libpng, so there is no way to support PNG. You have to install Pkg-config first.
The complete Ufop.yaml code is as follows.
Image:ubuntubuild_script:-Echo Building ...-MV $RESOURCE/*./-sudo ldconfig/usr/local/lib-tar zxvf pkg-config-0.2 9.tar.gz >/DEV/NULL-CD pkg-config-0.29 &&/configure--with-internal-glib && make >/dev/null 2& gt;&1 && sudo make install >/dev/null-tar zxvf libpng-1.6.24.tar.gz >/DEV/NULL-CD libpng-1.6.24 &A mp;&./configure >/dev/null && make >/dev/null && sudo make install >/dev/null-tar ZXVF ghostscript-9.15.tar.gz >/DEV/NULL-CD ghostscript-9.15 &&/configure >/dev/null && make >/d Ev/null 2>&1 && sudo make install >/DEV/NULL-TAR-ZXVF ImageMagick.tar.gz >/dev/null-/usr/local /bin/pkg-config--list-all-cd imagemagick-7.0.3-4/&&./configure--enable-shared=yes >/dev/null && ; Make >/dev/null && sudo make install >/dev/null-sudo ldconfig/usr/local/lib-echo "convert-list forma T "-chmod +x./runrun: ./run qufop.conf
Enclose the result diagram: