1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
|
%global _empty_manifest_terminate_build 0
Name: python-aws-bunker
Version: 0.4.5
Release: 1
Summary: bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. It can clone your git repos, and transfer ignored files from your machine to the ec2.
License: MIT License
URL: https://gitlab.com/shindagger/bunker
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/97/2e/980210a5bf9369af4bd118d72f1c1151b6e34bd3541ecd581b77ecf4b4d6/aws-bunker-0.4.5.tar.gz
BuildArch: noarch
Requires: python3-setuptools
Requires: python3-boto3
Requires: python3-inquirer
Requires: python3-paramiko
Requires: python3-tqdm
%description
# bunker
Bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. Among other things, it can clone your git repos and transfer ignored files from your machine to the ec2.
Working remotely, using cellular networks has been possible for ~15 years. As networks have evolved, bandwidth has become less and less of an issue, but even on today's cellular networks it is both impractical and costly to download large files, like docker images, zip archives, etc. One solution is to ssh into a VM on the cloud, and work from there, but managing git repos and private or ignored files across several machines quickly becomes problematic.
With bunker it is easier to automate this process. All you need is an instance ID for and AWS EC2 running ubuntu, and you can run shell scripts, source files to .profile, and copy over as many repos and ignored files as you want. Example:
```
# init bunker with your instance ID, etc
$ bunker init
# save some files to the ignored files list
$ bunker ignore config.ini .env.production terraform.tfvars
# run `/home/ubuntu/install-things.sh` on the instance
$ bunker install /home/ubuntu/install-things.sh
# source `/home/ubuntu/.prompt` to the .profile on the instance
$ bunker prompt /home/ubuntu/.prompt
# clone a local repo on the instance, and then copy over any files from the ignored file list
$ bunker build -r /path/to/local/repo
```
When used with our sample Terraform files (https://gitlab.com/shindagger/bunker), you can spin up a brand new EC2, clone the repos you need, copy over the ignored files, and be working in ~5 minutes. Terraform will output an instance ID you can use for `bunker init`. Then you can do the rest with a single command like:
```
$ bunker install -y && bunker prompt -y && bunker build -r /path/to/local/repo -y
```
For more information see the Terraform and Usage sections below.
## requirements
- python
- aws cli
- (terraform)
Also, you will need an EC2 instance on AWS, preferably running ubuntu>=18.04. This EC2 will need ssh (port 22) open and an attached SSM role (AmazonEC2RoleforSSM).
For more information on creating the SSM role for EC2 see:
https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-instance-profile.html#instance-profile-add-permissions
## installation
`$ pip intall aws-bunker`
NOTE: see shell scripts, and terraform sections below:
PROJECT HOME PAGE: https://gitlab.com/shindagger/bunker
### shell scripts
the `install` and `prompt` subcommands assume there will be shell scripts on the EC2. The default names (without positional arguments) are: `install-essentials.sh`, and `.prompt.sh` respectively.
the first shell script is intended for essential software (like python, pip, node, and npm). If the script is not already executable, use the \[-e\] flag. `prompt` simply sources a file in ~/.profile on the EC2.
See example scripts here (https://gitlab.com/shindagger/bunker) as well as the terraform section below:
### terraform
We have also included terraform files (https://gitlab.com/shindagger/bunker) which, when configured will spin up an EC2 instance you can use for bunker, with all the example shell scripts and your `.vimrc` provisioned. Of course you're encouraged to change these files according to preference. Terraform will output an instance ID you can use to init bunker with.
To configure and use these terraform files:
1. Clone this repo (https://gitlab.com/shindagger/bunker.git)
2. cd into the repo dir and `ls *.default`. These are the files you will need to edit before you init terraform. Each one of these files will need the extension `.tf.default` changed to `.tf`.
3. Edit `alfa.tf` and ensure that the region is correct.
4. Edit `beta.tf` and change the s3 bucket to a bucket you own. Also ensure the region is correct.
5. Edit `terraform.tfvars` with your AWS SDK access id and key. Also make sure you are configured to this account with `aws configure`
6. Edit `variables.tf` and change the default values to reflect your wishes. NOTE: if you don't have them already, you will need to create your own ssm role, and ssh key file manually. `ec2_key_name` is just the name of the keypair in AWS, while `ssh_private_key` is the full (absolute) path to your .pem file on your local machine.
7. `terraform init`
8. `terraform plan && terraform apply`
### before you init bunker
1. You have an EC2 instance ID. (see "terraform" above)
2. You have a directory (prefix) in which you will keep `repositories.txt` and `ignoredfiles.txt`. You can copy sample files from this repo, and edit them to reflect your repos and ignored files.
3. You have a .pem file and you know the path to its location. You have a keypair name set for your EC2, which uses this .pem file.
4. You know the username for the EC2 \(should be "ubuntu"\). We may choose to support other OSs in future versions.
5. You have created a private key for your git provider, and you added the public key in your git provider settings. Also, you have configured your local ssh to use this key and tested or used it at least once.
## bunker usage
`$ bunker -h`
**Show main bunker help page and exit**
`$ bunker build -h`
**Show help page for the subcommand `build` and exit.** This will work with any available subcommand
`$ bunker init`
**Write the bunker config file `~/.config-bunker.ini`.** If the file exists already, answers will be populated with existing values \[underlined\], and only overwritten if you offer a replacement value.
example `~/.config-bunker.ini`:
```
[default]
prefix = /Users/username/bunker-config
repos = repositories.txt
ignored = ignoredfiles.txt
pem = /Users/username/somename.pem
instance_id = i-04xxxxxxxxxxxx148
username = ubuntu
gitkeys = /Users/username/.ssh/git_rsa
```
`$ bunker repo path/to/repo /absolute/path/to/another-repo ../somerepo`
**Add or remove repo directories to/from repo file.** Use relative or absolute paths.
`$ bunker ignore .env.local config.ini terraform.tfvars`
**Add or remove filenames to/from ignore file.**
`$ bunker install`
`$ bunker install /home/ubuntu/script.sh`
**Install essential software on your EC2 instance.** This command will run an executable shell script on your EC2. The default script (without defining the positional argument) is named `/home/ubuntu/install-essentials.sh`. This is intended to install any software essential to using your EC2. In an effort to stay agnostic about what software users want on their EC2, bunker does not install with included shell scripts. We do however provide example shell scripts \(as well as terraform for the EC2\) at the project homepage:
https://gitlab.com/shindagger/bunker
`$ bunker prompt`
`$ bunker prompt /home/ubuntu/another-prompt.sh`
**Source a custom prompt file in `/home/ubuntu/.profile`.** This command will source a file in `/home/ubuntu/.profile`. The default name is: `/home/ubuntu/.prompt.sh`.
`$ bunker build`
**Clone list of git repos \(repositories.txt\) on your EC2 and then rsync list of ignored files \(ignoredfiles.txt\) from your local repos to the EC2 repos.** `git clone` will use ssh, assuming you have a public key setup at your git provider, a working `~/.ssh/config` tested at least once with `ssh -T git@PROVIDERURL`, and the associated private key set using `bunker init`.
%package -n python3-aws-bunker
Summary: bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. It can clone your git repos, and transfer ignored files from your machine to the ec2.
Provides: python-aws-bunker
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-aws-bunker
# bunker
Bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. Among other things, it can clone your git repos and transfer ignored files from your machine to the ec2.
Working remotely, using cellular networks has been possible for ~15 years. As networks have evolved, bandwidth has become less and less of an issue, but even on today's cellular networks it is both impractical and costly to download large files, like docker images, zip archives, etc. One solution is to ssh into a VM on the cloud, and work from there, but managing git repos and private or ignored files across several machines quickly becomes problematic.
With bunker it is easier to automate this process. All you need is an instance ID for and AWS EC2 running ubuntu, and you can run shell scripts, source files to .profile, and copy over as many repos and ignored files as you want. Example:
```
# init bunker with your instance ID, etc
$ bunker init
# save some files to the ignored files list
$ bunker ignore config.ini .env.production terraform.tfvars
# run `/home/ubuntu/install-things.sh` on the instance
$ bunker install /home/ubuntu/install-things.sh
# source `/home/ubuntu/.prompt` to the .profile on the instance
$ bunker prompt /home/ubuntu/.prompt
# clone a local repo on the instance, and then copy over any files from the ignored file list
$ bunker build -r /path/to/local/repo
```
When used with our sample Terraform files (https://gitlab.com/shindagger/bunker), you can spin up a brand new EC2, clone the repos you need, copy over the ignored files, and be working in ~5 minutes. Terraform will output an instance ID you can use for `bunker init`. Then you can do the rest with a single command like:
```
$ bunker install -y && bunker prompt -y && bunker build -r /path/to/local/repo -y
```
For more information see the Terraform and Usage sections below.
## requirements
- python
- aws cli
- (terraform)
Also, you will need an EC2 instance on AWS, preferably running ubuntu>=18.04. This EC2 will need ssh (port 22) open and an attached SSM role (AmazonEC2RoleforSSM).
For more information on creating the SSM role for EC2 see:
https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-instance-profile.html#instance-profile-add-permissions
## installation
`$ pip intall aws-bunker`
NOTE: see shell scripts, and terraform sections below:
PROJECT HOME PAGE: https://gitlab.com/shindagger/bunker
### shell scripts
the `install` and `prompt` subcommands assume there will be shell scripts on the EC2. The default names (without positional arguments) are: `install-essentials.sh`, and `.prompt.sh` respectively.
the first shell script is intended for essential software (like python, pip, node, and npm). If the script is not already executable, use the \[-e\] flag. `prompt` simply sources a file in ~/.profile on the EC2.
See example scripts here (https://gitlab.com/shindagger/bunker) as well as the terraform section below:
### terraform
We have also included terraform files (https://gitlab.com/shindagger/bunker) which, when configured will spin up an EC2 instance you can use for bunker, with all the example shell scripts and your `.vimrc` provisioned. Of course you're encouraged to change these files according to preference. Terraform will output an instance ID you can use to init bunker with.
To configure and use these terraform files:
1. Clone this repo (https://gitlab.com/shindagger/bunker.git)
2. cd into the repo dir and `ls *.default`. These are the files you will need to edit before you init terraform. Each one of these files will need the extension `.tf.default` changed to `.tf`.
3. Edit `alfa.tf` and ensure that the region is correct.
4. Edit `beta.tf` and change the s3 bucket to a bucket you own. Also ensure the region is correct.
5. Edit `terraform.tfvars` with your AWS SDK access id and key. Also make sure you are configured to this account with `aws configure`
6. Edit `variables.tf` and change the default values to reflect your wishes. NOTE: if you don't have them already, you will need to create your own ssm role, and ssh key file manually. `ec2_key_name` is just the name of the keypair in AWS, while `ssh_private_key` is the full (absolute) path to your .pem file on your local machine.
7. `terraform init`
8. `terraform plan && terraform apply`
### before you init bunker
1. You have an EC2 instance ID. (see "terraform" above)
2. You have a directory (prefix) in which you will keep `repositories.txt` and `ignoredfiles.txt`. You can copy sample files from this repo, and edit them to reflect your repos and ignored files.
3. You have a .pem file and you know the path to its location. You have a keypair name set for your EC2, which uses this .pem file.
4. You know the username for the EC2 \(should be "ubuntu"\). We may choose to support other OSs in future versions.
5. You have created a private key for your git provider, and you added the public key in your git provider settings. Also, you have configured your local ssh to use this key and tested or used it at least once.
## bunker usage
`$ bunker -h`
**Show main bunker help page and exit**
`$ bunker build -h`
**Show help page for the subcommand `build` and exit.** This will work with any available subcommand
`$ bunker init`
**Write the bunker config file `~/.config-bunker.ini`.** If the file exists already, answers will be populated with existing values \[underlined\], and only overwritten if you offer a replacement value.
example `~/.config-bunker.ini`:
```
[default]
prefix = /Users/username/bunker-config
repos = repositories.txt
ignored = ignoredfiles.txt
pem = /Users/username/somename.pem
instance_id = i-04xxxxxxxxxxxx148
username = ubuntu
gitkeys = /Users/username/.ssh/git_rsa
```
`$ bunker repo path/to/repo /absolute/path/to/another-repo ../somerepo`
**Add or remove repo directories to/from repo file.** Use relative or absolute paths.
`$ bunker ignore .env.local config.ini terraform.tfvars`
**Add or remove filenames to/from ignore file.**
`$ bunker install`
`$ bunker install /home/ubuntu/script.sh`
**Install essential software on your EC2 instance.** This command will run an executable shell script on your EC2. The default script (without defining the positional argument) is named `/home/ubuntu/install-essentials.sh`. This is intended to install any software essential to using your EC2. In an effort to stay agnostic about what software users want on their EC2, bunker does not install with included shell scripts. We do however provide example shell scripts \(as well as terraform for the EC2\) at the project homepage:
https://gitlab.com/shindagger/bunker
`$ bunker prompt`
`$ bunker prompt /home/ubuntu/another-prompt.sh`
**Source a custom prompt file in `/home/ubuntu/.profile`.** This command will source a file in `/home/ubuntu/.profile`. The default name is: `/home/ubuntu/.prompt.sh`.
`$ bunker build`
**Clone list of git repos \(repositories.txt\) on your EC2 and then rsync list of ignored files \(ignoredfiles.txt\) from your local repos to the EC2 repos.** `git clone` will use ssh, assuming you have a public key setup at your git provider, a working `~/.ssh/config` tested at least once with `ssh -T git@PROVIDERURL`, and the associated private key set using `bunker init`.
%package help
Summary: Development documents and examples for aws-bunker
Provides: python3-aws-bunker-doc
%description help
# bunker
Bunker is a command line program for setting up an ec2 in AWS for remote development or as a backup. Among other things, it can clone your git repos and transfer ignored files from your machine to the ec2.
Working remotely, using cellular networks has been possible for ~15 years. As networks have evolved, bandwidth has become less and less of an issue, but even on today's cellular networks it is both impractical and costly to download large files, like docker images, zip archives, etc. One solution is to ssh into a VM on the cloud, and work from there, but managing git repos and private or ignored files across several machines quickly becomes problematic.
With bunker it is easier to automate this process. All you need is an instance ID for and AWS EC2 running ubuntu, and you can run shell scripts, source files to .profile, and copy over as many repos and ignored files as you want. Example:
```
# init bunker with your instance ID, etc
$ bunker init
# save some files to the ignored files list
$ bunker ignore config.ini .env.production terraform.tfvars
# run `/home/ubuntu/install-things.sh` on the instance
$ bunker install /home/ubuntu/install-things.sh
# source `/home/ubuntu/.prompt` to the .profile on the instance
$ bunker prompt /home/ubuntu/.prompt
# clone a local repo on the instance, and then copy over any files from the ignored file list
$ bunker build -r /path/to/local/repo
```
When used with our sample Terraform files (https://gitlab.com/shindagger/bunker), you can spin up a brand new EC2, clone the repos you need, copy over the ignored files, and be working in ~5 minutes. Terraform will output an instance ID you can use for `bunker init`. Then you can do the rest with a single command like:
```
$ bunker install -y && bunker prompt -y && bunker build -r /path/to/local/repo -y
```
For more information see the Terraform and Usage sections below.
## requirements
- python
- aws cli
- (terraform)
Also, you will need an EC2 instance on AWS, preferably running ubuntu>=18.04. This EC2 will need ssh (port 22) open and an attached SSM role (AmazonEC2RoleforSSM).
For more information on creating the SSM role for EC2 see:
https://docs.aws.amazon.com/systems-manager/latest/userguide/setup-instance-profile.html#instance-profile-add-permissions
## installation
`$ pip intall aws-bunker`
NOTE: see shell scripts, and terraform sections below:
PROJECT HOME PAGE: https://gitlab.com/shindagger/bunker
### shell scripts
the `install` and `prompt` subcommands assume there will be shell scripts on the EC2. The default names (without positional arguments) are: `install-essentials.sh`, and `.prompt.sh` respectively.
the first shell script is intended for essential software (like python, pip, node, and npm). If the script is not already executable, use the \[-e\] flag. `prompt` simply sources a file in ~/.profile on the EC2.
See example scripts here (https://gitlab.com/shindagger/bunker) as well as the terraform section below:
### terraform
We have also included terraform files (https://gitlab.com/shindagger/bunker) which, when configured will spin up an EC2 instance you can use for bunker, with all the example shell scripts and your `.vimrc` provisioned. Of course you're encouraged to change these files according to preference. Terraform will output an instance ID you can use to init bunker with.
To configure and use these terraform files:
1. Clone this repo (https://gitlab.com/shindagger/bunker.git)
2. cd into the repo dir and `ls *.default`. These are the files you will need to edit before you init terraform. Each one of these files will need the extension `.tf.default` changed to `.tf`.
3. Edit `alfa.tf` and ensure that the region is correct.
4. Edit `beta.tf` and change the s3 bucket to a bucket you own. Also ensure the region is correct.
5. Edit `terraform.tfvars` with your AWS SDK access id and key. Also make sure you are configured to this account with `aws configure`
6. Edit `variables.tf` and change the default values to reflect your wishes. NOTE: if you don't have them already, you will need to create your own ssm role, and ssh key file manually. `ec2_key_name` is just the name of the keypair in AWS, while `ssh_private_key` is the full (absolute) path to your .pem file on your local machine.
7. `terraform init`
8. `terraform plan && terraform apply`
### before you init bunker
1. You have an EC2 instance ID. (see "terraform" above)
2. You have a directory (prefix) in which you will keep `repositories.txt` and `ignoredfiles.txt`. You can copy sample files from this repo, and edit them to reflect your repos and ignored files.
3. You have a .pem file and you know the path to its location. You have a keypair name set for your EC2, which uses this .pem file.
4. You know the username for the EC2 \(should be "ubuntu"\). We may choose to support other OSs in future versions.
5. You have created a private key for your git provider, and you added the public key in your git provider settings. Also, you have configured your local ssh to use this key and tested or used it at least once.
## bunker usage
`$ bunker -h`
**Show main bunker help page and exit**
`$ bunker build -h`
**Show help page for the subcommand `build` and exit.** This will work with any available subcommand
`$ bunker init`
**Write the bunker config file `~/.config-bunker.ini`.** If the file exists already, answers will be populated with existing values \[underlined\], and only overwritten if you offer a replacement value.
example `~/.config-bunker.ini`:
```
[default]
prefix = /Users/username/bunker-config
repos = repositories.txt
ignored = ignoredfiles.txt
pem = /Users/username/somename.pem
instance_id = i-04xxxxxxxxxxxx148
username = ubuntu
gitkeys = /Users/username/.ssh/git_rsa
```
`$ bunker repo path/to/repo /absolute/path/to/another-repo ../somerepo`
**Add or remove repo directories to/from repo file.** Use relative or absolute paths.
`$ bunker ignore .env.local config.ini terraform.tfvars`
**Add or remove filenames to/from ignore file.**
`$ bunker install`
`$ bunker install /home/ubuntu/script.sh`
**Install essential software on your EC2 instance.** This command will run an executable shell script on your EC2. The default script (without defining the positional argument) is named `/home/ubuntu/install-essentials.sh`. This is intended to install any software essential to using your EC2. In an effort to stay agnostic about what software users want on their EC2, bunker does not install with included shell scripts. We do however provide example shell scripts \(as well as terraform for the EC2\) at the project homepage:
https://gitlab.com/shindagger/bunker
`$ bunker prompt`
`$ bunker prompt /home/ubuntu/another-prompt.sh`
**Source a custom prompt file in `/home/ubuntu/.profile`.** This command will source a file in `/home/ubuntu/.profile`. The default name is: `/home/ubuntu/.prompt.sh`.
`$ bunker build`
**Clone list of git repos \(repositories.txt\) on your EC2 and then rsync list of ignored files \(ignoredfiles.txt\) from your local repos to the EC2 repos.** `git clone` will use ssh, assuming you have a public key setup at your git provider, a working `~/.ssh/config` tested at least once with `ssh -T git@PROVIDERURL`, and the associated private key set using `bunker init`.
%prep
%autosetup -n aws-bunker-0.4.5
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-aws-bunker -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Tue May 30 2023 Python_Bot <Python_Bot@openeuler.org> - 0.4.5-1
- Package Spec generated
|