<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:series="https://publishpress.com/"
	>

<channel>
	<title>Tùng Nguyễn, Author at Tomoshare</title>
	<atom:link href="https://blog.tomosia.com.vn/author/tungnguyen1/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.tomosia.com.vn/author/tungnguyen1/</link>
	<description>Kênh chia sẻ kiến thức Tomosia Việt Nam</description>
	<lastBuildDate>Thu, 19 Oct 2023 01:36:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://blog.tomosia.com.vn/wp-content/uploads/2023/09/cropped-icon-32x32.png</url>
	<title>Tùng Nguyễn, Author at Tomoshare</title>
	<link>https://blog.tomosia.com.vn/author/tungnguyen1/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Tích hợp Minio với Rails app</title>
		<link>https://blog.tomosia.com.vn/tich-hop-minio-voi-rails-app/</link>
					<comments>https://blog.tomosia.com.vn/tich-hop-minio-voi-rails-app/#comments</comments>
		
		<dc:creator><![CDATA[Tùng Nguyễn]]></dc:creator>
		<pubDate>Thu, 19 Oct 2023 01:36:24 +0000</pubDate>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Minio]]></category>
		<category><![CDATA[Aws]]></category>
		<guid isPermaLink="false">https://blog.tomosia.com.vn/?p=1335</guid>

					<description><![CDATA[<p>Min.io&#160;&#8211; Object Storage Server và cách để tích hợp MinIO vào trong ứng dụng Rails. Mời các bạn&#8230;</p>
<p>The post <a href="https://blog.tomosia.com.vn/tich-hop-minio-voi-rails-app/">Tích hợp Minio với Rails app</a> appeared first on <a href="https://blog.tomosia.com.vn">Tomoshare</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph"><a rel="noreferrer noopener" href="http://min.io/" target="_blank">Min.io</a>&nbsp;&#8211; Object Storage Server và cách để tích hợp MinIO vào trong ứng dụng Rails. Mời các bạn cùng đọc</p>



<p class="wp-block-paragraph">1, <strong>Minio là gi?</strong></p>



<pre class="wp-block-code"><code>High Performance Object Storage
for Modern Data Lakes

<code>MinIO is a high-performance, S3 compatible object store. It is built for
large scale AI/ML, data lake and database workloads. It is software-defined
and runs on any cloud or on-premises infrastructure. MinIO is dual-licensed
under open source GNU AGPL v3 and a commercial enterprise license.</code></code></pre>



<p class="wp-block-paragraph">để ngắn gọn hơn thì: <strong>Minio giống như dịch vụ AWS S3, nhưng được host local</strong>.</p>



<p class="wp-block-paragraph">Minio là một object storage server được implement những public API giống như AWS S3. Điều đó có nghĩa là những ứng dụng có thể config để giao tiếp với Minio thì cũng có thể giao tiếp với AWS S3. Là một server lưu trữ object nên có thể được sử dụng để lưu trữ những unstructured data như ảnh, video, log files, backups và container/VM images. Dung lượng của 1 object có thể dao động từ một vài KB tới tối đa là 5TB. File cũng được gom lại trong 1 buckets, nó là được chỉ cùng với access key khi dùng app. Đây là giao diện của minio:</p>



<figure class="wp-block-image size-large"><img fetchpriority="high" decoding="async" width="1024" height="518" src="http://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-1024x518.png" alt="" class="wp-image-1338" srcset="https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-1024x518.png 1024w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-300x152.png 300w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-768x389.png 768w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-1536x778.png 1536w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-380x192.png 380w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-800x405.png 800w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47-1160x587.png 1160w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-47.png 1839w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1024" height="532" src="http://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49.png" alt="This image has an empty alt attribute; its file name is image-48-1024x532.png" class="wp-image-1340" srcset="https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49.png 1024w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49-300x156.png 300w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49-768x399.png 768w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49-380x197.png 380w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-49-800x416.png 800w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">2, <strong>Setup đơn giản</strong></p>



<p class="wp-block-paragraph">Minio có các gói docker được cài sẵn và có thể cài trực tiếp. ở đây mình sẽ chia sẽ cách cài trực tiếp với Ubuntu</p>



<p class="wp-block-paragraph">Lệnh cài minio server</p>



<pre class="wp-block-code"><code>wget https://dl.min.io/server/minio/release/linux-amd64/archive/minio_20231007150738.0.0_amd64.deb -O minio.deb
sudo dpkg -i minio.deb</code></pre>



<p class="wp-block-paragraph"><br>kiểm tra minio đã được cài hay chưa</p>



<pre class="wp-block-code"><code>which minio   
### /usr/local/bin/minio </code></pre>



<p class="wp-block-paragraph">Run minio. chạy lệnh sau để run minio trên máy local. có thể thay thế thư mục tùy theo ý minh</p>



<pre class="wp-block-code"><code>mkdir ~/minio #thư mục lưu trữ 
minio server ~/minio --console-address :9001</code></pre>



<p class="wp-block-paragraph">kết quả <br></p>



<figure class="wp-block-image size-large"><img decoding="async" width="1024" height="295" src="http://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-1024x295.png" alt="" class="wp-image-1343" srcset="https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-1024x295.png 1024w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-300x87.png 300w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-768x222.png 768w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-1536x443.png 1536w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-380x110.png 380w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-800x231.png 800w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51-1160x335.png 1160w, https://blog.tomosia.com.vn/wp-content/uploads/2023/10/image-51.png 1685w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p class="wp-block-paragraph">3, config với rails</p>



<p class="wp-block-paragraph">thêm config này vào file storage.yml</p>



<pre class="wp-block-code"><code>minio:
  service: S3
  access_key_id: &lt;%= ENV&#91;'MINIO_USER'] %&gt;
  secret_access_key: &lt;%= ENV&#91;'MINIO_PASSWORD'] %&gt;
  region: us-east-1
  bucket: xxxx
  endpoint: &lt;%= ENV&#91;'MINIO_ENPOINT'] %&gt;
  force_path_style: true
</code></pre>



<p class="wp-block-paragraph">thêm config này vào enviroments</p>



<pre class="wp-block-code"><code>config.active_storage.service = :minio</code></pre>



<p class="wp-block-paragraph">Như vậy là có thể upload và quản lí file với minio!!!<br></p>



<p class="wp-block-paragraph">Tiếp đến là tạo một views upload đơn giản rồi chạy&nbsp;<code>rails s</code>&nbsp;và xem kết quả&nbsp;</p>



<figure class="wp-block-image"><img decoding="async" src="https://twemoji.maxcdn.com/v/14.0.2/72x72/1f603.png" alt="😃"/></figure>



<p class="wp-block-paragraph">&nbsp;Happy coding !</p>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://blog.tomosia.com.vn/tich-hop-minio-voi-rails-app/">Tích hợp Minio với Rails app</a> appeared first on <a href="https://blog.tomosia.com.vn">Tomoshare</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.tomosia.com.vn/tich-hop-minio-voi-rails-app/feed/</wfw:commentRss>
			<slash:comments>8</slash:comments>
		
		
			</item>
	</channel>
</rss>
