-
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.
Merge pull request #4 from Otus-DevOps-2023-05/packer-base
Packer base
- Loading branch information
Showing
14 changed files
with
129 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/packer/variable.json | ||
*~ |
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,5 +1,5 @@ | ||
# Den85s_infra | ||
|
||
|
||
testapp_IP = 158.160.114.141 | ||
testapp_port = 9292 | ||
установлен Packer | ||
создан шаблон ubuntu16.json для создания baked-образа | ||
создан шаблон immutable.json.json для создания bake-образа c запущенным http сервером |
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,5 +1,5 @@ | ||
# Den85s_infra | ||
|
||
|
||
testapp_IP = 62.84.118.51 | ||
testapp_IP = 158.160.114.141 | ||
testapp_port = 9292 |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,12 @@ | ||
#!/bin/bash | ||
|
||
sudo apt-get update | ||
sudo apt-get install -y git | ||
git clone -b monolith https://github.com/express42/reddit.git | ||
cd reddit && bundle install | ||
# puma -d | ||
sudo mv /tmp/puma.service /etc/systemd/system/puma.service | ||
|
||
sudo systemctl start puma | ||
|
||
sudo systemctl enable puma |
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,13 @@ | ||
[Unit] | ||
Description=puma | ||
After=network.target | ||
|
||
[Service] | ||
Type=simple | ||
User=ubuntu | ||
WorkingDirectory=/home/ubuntu/reddit | ||
ExecStart=/bin/bash -lc 'puma' | ||
Restart=always | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
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,37 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"type": "yandex", | ||
"service_account_key_file": "{{user `service_account_key_file`}}", | ||
"folder_id": "{{user `folder_id`}}", | ||
"source_image_family": "{{user `source_image_family`}}", | ||
"image_name": "reddit-base-{{timestamp}}", | ||
"image_family": "reddit-full", | ||
"ssh_username": "ubuntu", | ||
"platform_id": "standard-v1", | ||
"use_ipv4_nat": "true" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "shell", | ||
"script": "scripts/install_ruby.sh", | ||
"execute_command": "sudo {{.Path}}" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "scripts/install_mongodb.sh", | ||
"execute_command": "sudo {{.Path}}" | ||
}, | ||
{ | ||
"type": "file", | ||
"source": "files/puma.service", | ||
"destination": "/tmp/puma.service" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "files/install_reddit.sh", | ||
"execute_command": "sudo {{.Path}}" | ||
} | ||
] | ||
} |
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,8 @@ | ||
{ | ||
"id": "ajeXXXXXXXXXX8c", | ||
"service_account_id": "ajXXXXXXXXXXmrm", | ||
"created_at": "2023-08-16T17:54:47.800670721Z", | ||
"key_algorithm": "RSA_2048", | ||
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIoHfu/Z25UbMjXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX+\nJQIDAQAB\n-----END PUBLIC KEY-----\n", | ||
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXgIz4RUTvMKJBts=\n-----END PRIVATE KEY-----\n" | ||
} |
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,17 @@ | ||
#!/bin/bash | ||
|
||
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common | ||
|
||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - | ||
|
||
wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - | ||
|
||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list | ||
|
||
sudo apt-get update | ||
|
||
sudo apt-get install -y mongodb-org | ||
|
||
sudo systemctl start mongod | ||
sudo systemctl enable mongod | ||
sudo systemctl status mongod |
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,4 @@ | ||
#!/bin/bash | ||
|
||
sudo apt update | ||
sudo apt install -y ruby-full bundler build-essential |
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,27 @@ | ||
{ | ||
"builders": [ | ||
{ | ||
"type": "yandex", | ||
"service_account_key_file": "{{user `service_account_key_file`}}", | ||
"folder_id": "{{user `folder_id`}}", | ||
"source_image_family": "{{user `source_image_family`}}", | ||
"image_name": "reddit-base-{{timestamp}}", | ||
"image_family": "reddit-base", | ||
"ssh_username": "ubuntu", | ||
"platform_id": "standard-v1", | ||
"use_ipv4_nat": "true" | ||
} | ||
], | ||
"provisioners": [ | ||
{ | ||
"type": "shell", | ||
"script": "scripts/install_ruby.sh", | ||
"execute_command": "sudo {{.Path}}" | ||
}, | ||
{ | ||
"type": "shell", | ||
"script": "scripts/install_mongodb.sh", | ||
"execute_command": "sudo {{.Path}}" | ||
} | ||
] | ||
} |
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,5 @@ | ||
{ | ||
"service_account_key_file": "key.json", | ||
"folder_id": "XXXXXXXXXXXXXXXXXXXX", | ||
"source_image_family": "ubuntu-1604-lts" | ||
} |