-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
283 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
google_site_verification: 5fmAexd12deXwT9mT0H8wh8UqaiTHuAQ5KoubFtQui4 | ||
google_analytics: G-GJVBBPXJ3P | ||
url: https://o-h-y-o.github.io/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# Deploying to AWS S3 (Vue3 + Quasar + pnpm) | ||
|
||
We will proceed with the deployment to AWS (Amazon Web Services) Simple Storage Service (S3), a highly scalable and economical cloud storage service. | ||
|
||
By building your projects on AWS S3, you can take advantage of the scalability, reliability, and cost-effectiveness of the AWS Cloud. | ||
|
||
AWS S3 also makes it easy to serve static websites, simplifying the deployment process and reducing infrastructure complexity. | ||
|
||
If you don't have an AWS account, please create one. | ||
We will be using github actions, so please upload your project to the github repository. | ||
|
||
1. Log in to your <a href="https://ap-northeast-2.console.aws.amazon.com/console/home">AWS</a> account. | ||
|
||
2. Go to the S3 Dashboard and click the Create Bucket button. | ||
|
||
3. Enter the bucket name and `AWS Region` as `Asia Pacific (Seoul) ap-northeast-2`. | ||
|
||
4. For object ownership, click `Enable ACL`. | ||
|
||
5. Release all public access blocks and click the Create Bucket button. | ||
|
||
6. After clicking on the bucket you created, click on the properties tab. | ||
|
||
7. Press the Edit button of `Static Website Hosting` at the bottom of the Properties tab to `Enable` it. | ||
|
||
8. If you implemented `index.html` for the index document and an error page for the error document, you do not need to enter the corresponding page or index.html or anything else. Save your changes. | ||
|
||
9. Go to the Permissions tab and click the 'Edit Bucket Policy' button to paste the text below. | ||
|
||
```json | ||
// Bucket policy to allow public access | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Sid": "PublicReadGetObject", | ||
"Effect": "Allow", | ||
"Principal": "*", | ||
"Action": "s3:GetObject", | ||
"Resource": "arn:aws:s3:::nextbit/*" | ||
} | ||
] | ||
} | ||
``` | ||
|
||
You can manually upload the project build folder, but let's do an automatic deployment using github actions. | ||
|
||
First, get `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` from <a href="http://us-east-1.console.aws.amazon.com/iamv2/home" target="_blank">IAM</a>. It is. | ||
|
||
1. In IAM, click Manage Access => Users => Add User button. | ||
|
||
2. Enter the user name and click Next. | ||
|
||
3. Change the Permissions option to Direct Policy Attachment, search for `AmazonS3FullAccess`, check it, click Next, and click the Create User button. | ||
|
||
4. Click on the created user to enter and click on `Create Access Key` on the `Security Credentials` tab. | ||
|
||
5. Select `Local Code` as the use case and press `Create Access Key`. | ||
|
||
6. Download the `.csv file` and save the access key and `secret access key (secret key)` well. | ||
|
||
7. Click the `Settings` tab in the Github repository. | ||
|
||
8. Click Security => Secrets and variables => Actions and click New repository secret. | ||
|
||
9. Name: `AWS_ACCESS_KEY_ID`, Secret: Enter the issued `Access Key` and create it. | ||
|
||
10. Name: `AWS_SECRET_ACCESS_KEY` , Secret: Enter the issued `Secret Access Key (Secret Key)` and create it. | ||
|
||
11. Click the `Actions` tab in the github repository. | ||
|
||
12. Press the `New workflow` button. | ||
|
||
13. Press `set up a workflow yourself`. | ||
|
||
14. Name the yml file freely. | ||
|
||
15. Enter the code below. | ||
|
||
```yml | ||
name: Vue Build and Deploy to S3 | ||
|
||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Install dependencies | ||
run: pnpm add @quasar/cli -g && pnpm install | ||
|
||
- name: Build | ||
run: pnpm run build:pwa | ||
|
||
- uses: jakejarvis/s3-sync-action@master | ||
with: | ||
args: --acl public-read --follow-symlinks --delete | ||
env: | ||
AWS_S3_BUCKET: <Bucket_Name> | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: ap-northeast-2 | ||
SOURCE_DIR: "dist/pwa" | ||
``` | ||
Enter the name of your S3 bucket in `<Bucket_Name>`. | ||
|
||
If you followed the process of the posting well, it will be automatically deployed to AWS S3. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Get exposed in Google search | ||
|
||
Create a <a href="https://analytics.google.com/analytics/web/?authuser=0#/provision/SignUp/" target="_blank">Google Analytics</a> account. | ||
|
||
In the business details, I set the industry as `Online Community`, business goal as `Lead Generation`, and `User Behavior Review`. You can do it with something else. | ||
|
||
If you use a distribution project root or theme, create a `_config.yml` file in the src/public folder and enter the code below. | ||
|
||
```yml | ||
# _config.yml | ||
google_analytics: { Tracking ID } | ||
url: { Distribution URL } # https://username.github.io/ | ||
``` | ||
Click Get started in <a href="https://search.google.com/search-console/about?hl=en&utm_source=wmx&utm_medium=wmx-welcome" target="_blank">Google Search Console</a> . | ||
Select `URL Prefix` and enter `https://username.github.io/`. | ||
|
||
Confirm ownership by choosing the recommended verification method or 4 other verification methods. | ||
|
||
I will do the recommended verification method. Download the html file and put it in the root. | ||
|
||
And if you use the root folder or theme, create a `sitemap.yml` file in the src/public folder and put the code below as it is. | ||
|
||
```yml | ||
--- | ||
--- | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
{% for post in site.posts %} | ||
<url> | ||
<loc>{{ site.url }}{{ post.url | remove: 'index.html' }}</loc> | ||
</url> | ||
{% endfor %} | ||
{% for page in site.pages %} | ||
{% if page.layout != nil %} | ||
{% if page.layout != 'feed' %} | ||
<url> | ||
<loc>{{ site.url }}{{ page.url | remove: 'index.html' }}</loc> | ||
</url> | ||
{% endif %} | ||
{% endif %} | ||
{% endfor %} | ||
</urlset> | ||
``` | ||
|
||
::: tip | ||
|
||
If you use vuepress, you can use <a href="https://plugin-sitemap2.vuejs.press/" target="_blank">vuepress-plugin-sitemap2</a> to automatically create and manage sitemaps. | ||
|
||
::: | ||
|
||
After that, google search console => Index creation => Go to `https://username.github.io/sitemap.xml` in `Sitemaps` and submit. After that, check if your blog is showing up well in Google search. It may take some time before exposure. |