Skip to content
Snippets Groups Projects
Commit 9036840e authored by ludo8147's avatar ludo8147
Browse files

vagrant vm locally

parent efdf97d5
No related branches found
No related tags found
No related merge requests found
Pipeline #69240 passed
Showing
with 2496 additions and 473 deletions
......@@ -3,3 +3,6 @@ artifact.bin
*.bin
setup.txt
todos
Spin_up_a_virtual_machine_locally/webservice
Spin_up_a_virtual_machine_locally/.vagrant
\ No newline at end of file
......@@ -2,7 +2,8 @@
# und Vorlesung
#https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
#https://docs.gitlab.com/ee/ci/yaml/workflow.html
# https://docs.gitlab.com/ee/ci/yaml/
#https://docs.gitlab.com/ee/ci/yaml/
#https://dnsmichi.at/2021/09/23/efficient-pipelines-gitlab-ci-cd-parallel-matrix-builds-reference/
workflow:
rules:
......
#Code: https://github.com/lucendio/lecture-devops-code/blob/master/tutorials/define-and-run-pipeline/.gitlab-ci.yml
# und Vorlesung
#https://docs.gitlab.com/ee/user/packages/container_registry/build_and_push_images.html
#https://docs.gitlab.com/ee/ci/yaml/workflow.html
#https://docs.gitlab.com/ee/ci/yaml/
#https://dnsmichi.at/2021/09/23/efficient-pipelines-gitlab-ci-cd-parallel-matrix-builds-reference/
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"
......@@ -39,7 +46,7 @@ job_publish:
stage: 'publish'
image: 'public.ecr.aws/lts/ubuntu:22.04'
tags:
- docker-privileged
- gitlab-runner03
dependencies:
- job_build
before_script:
......
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://vagrantcloud.com/search.
config.vm.box = "ubuntu/focal64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# NOTE: This will enable public access to the opened port
# config.vm.network "forwarded_port", guest: 3000, host: 8080
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine and only allow access
# via 127.0.0.1 to disable public access
config.vm.network "forwarded_port", guest: 3000, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "C:/Users/lucad/lucadVM", "/home/vagrant/vagrant_data"
# Disable the default share of the current code directory. Doing this
# provides improved isolation between the vagrant box and your host
# by making sure your Vagrantfile isn't accessible to the vagrant box.
# If you use this you may want to enable additional shared subfolders as
# shown above.
# config.vm.synced_folder ".", "/vagrant", disabled: true
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Enable provisioning with a shell script. Additional provisioners such as
# Ansible, Chef, Docker, Puppet and Salt are also available. Please see the
# documentation for more information about their specific syntax and use.
# config.vm.provision "shell", inline: <<-SHELL
# apt-get update
# apt-get install -y apache2
# SHELL
end
Microsoft Windows [Version 10.0.19045.4412]
(c) Microsoft Corporation. Alle Rechte vorbehalten.
C:\Users\lucad>cd lucadVM
C:\Users\lucad\lucadVM>vagrant up --provider virtaulbox
An active machine was found with a different provider. Vagrant
currently allows each machine to be brought up with only a single
provider at a time. A future version will remove this limitation.
Until then, please destroy the existing machine to up with a new
provider.
Machine name: default
Active provider: virtualbox
Requested provider: virtaulbox
C:\Users\lucad\lucadVM>vagrant ssh
VM must be running to open SSH connection. Run `vagrant up`
to start the virtual machine.
C:\Users\lucad\lucadVM>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/focal64' version '20240524.0.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 3000 (guest) => 8080 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 6.1.50
default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
default: /vagrant => C:/Users/lucad/lucadVM
default: /vagrant_data => C:/Users/lucad/lucadVM
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
C:\Users\lucad\lucadVM>vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-182-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jun 2 13:52:41 UTC 2024
System load: 0.64 Processes: 119
Usage of /: 3.6% of 38.70GB Users logged in: 0
Memory usage: 20% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Wed May 29 14:18:47 2024 from 10.0.2.2
vagrant@ubuntu-focal:~$ ls
vagrant@ubuntu-focal:~$ dir
vagrant@ubuntu-focal:~$ cd ..
vagrant@ubuntu-focal:/home$ ls
ubuntu vagrant
vagrant@ubuntu-focal:/home$ cd $PATH
-bash: cd: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin: No such file or directory
vagrant@ubuntu-focal:/home$ exit
logout
Connection to 127.0.0.1 closed.
C:\Users\lucad\lucadVM>vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-182-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jun 2 13:54:28 UTC 2024
System load: 0.15 Processes: 121
Usage of /: 3.6% of 38.70GB Users logged in: 0
Memory usage: 26% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sun Jun 2 13:52:42 2024 from 10.0.2.2
vagrant@ubuntu-focal:~$ pwd
/home/vagrant
vagrant@ubuntu-focal:~$ ls -a
. .. .bash_history .bash_logout .bashrc .cache .profile .ssh
vagrant@ubuntu-focal:~$ ls -all
total 32
drwxr-xr-x 4 vagrant vagrant 4096 May 29 14:19 .
drwxr-xr-x 4 root root 4096 May 29 14:18 ..
-rw------- 1 vagrant vagrant 35 Jun 2 13:54 .bash_history
-rw-r--r-- 1 vagrant vagrant 220 May 24 21:56 .bash_logout
-rw-r--r-- 1 vagrant vagrant 3771 May 24 21:56 .bashrc
drwx------ 2 vagrant vagrant 4096 May 29 14:18 .cache
-rw-r--r-- 1 vagrant vagrant 807 May 24 21:56 .profile
drwx------ 2 vagrant vagrant 4096 May 29 14:18 .ssh
vagrant@ubuntu-focal:~$ cd ..
vagrant@ubuntu-focal:/home$ ls
ubuntu vagrant
vagrant@ubuntu-focal:/home$ cd ..
vagrant@ubuntu-focal:/$ ls
bin dev home lib32 libx32 media opt root sbin srv tmp vagrant var
boot etc lib lib64 lost+found mnt proc run snap sys usr vagrant_data
vagrant@ubuntu-focal:/$ exit
logout
Connection to 127.0.0.1 closed.
C:\Users\lucad\lucadVM>vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-182-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jun 2 13:57:51 UTC 2024
System load: 0.0 Processes: 118
Usage of /: 3.6% of 38.70GB Users logged in: 0
Memory usage: 25% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sun Jun 2 13:54:29 2024 from 10.0.2.2
vagrant@ubuntu-focal:~$ ls
vagrant@ubuntu-focal:~$ cd ..
vagrant@ubuntu-focal:/home$ cd ..
vagrant@ubuntu-focal:/$ ls
bin dev home lib32 libx32 media opt root sbin srv tmp vagrant var
boot etc lib lib64 lost+found mnt proc run snap sys usr vagrant_data
vagrant@ubuntu-focal:/$ exit
logout
Connection to 127.0.0.1 closed.
C:\Users\lucad\lucadVM>vagrant halt
==> default: Attempting graceful shutdown of VM...
C:\Users\lucad\lucadVM>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/focal64' version '20240524.0.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 3000 (guest) => 8080 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 6.1.50
default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
default: /vagrant => C:/Users/lucad/lucadVM
default: /home/vagrant/vagrant_data => C:/Users/lucad/lucadVM
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
C:\Users\lucad\lucadVM>vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-182-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jun 2 14:09:56 UTC 2024
System load: 0.05 Processes: 115
Usage of /: 3.6% of 38.70GB Users logged in: 0
Memory usage: 19% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sun Jun 2 13:57:52 2024 from 10.0.2.2
vagrant@ubuntu-focal:~$ ls
vagrant_data
vagrant@ubuntu-focal:~$ cd vagrant_data/
vagrant@ubuntu-focal:~/vagrant_data$ ls
Vagrantfile terminal.log webservice
vagrant@ubuntu-focal:~/vagrant_data$ cd ..
vagrant@ubuntu-focal:~$ chmod +x ./vagrant_data/webservice
vagrant@ubuntu-focal:~$ ./vagrant_data/webservice
┌───────────────────────────────────────────────────┐
│ webservice │
│ Fiber v2.51.0 │
│ http://127.0.0.1:3000 │
│ │
│ Handlers ............ 27 Processes ........... 1 │
│ Prefork ....... Disabled PID .............. 1725 │
└───────────────────────────────────────────────────┘
^Ctime=2024-06-02T14:18:07.271Z level=INFO msg="Gracefully shutting down HTTP server"
vagrant@ubuntu-focal:~$ ^C
vagrant@ubuntu-focal:~$ chmod +x ./vagrant_data/webservice
vagrant@ubuntu-focal:~$ ./vagrant_data/webservice
┌───────────────────────────────────────────────────┐
│ webservice │
│ Fiber v2.51.0 │
│ http://127.0.0.1:3000 │
│ │
│ Handlers ............ 27 Processes ........... 1 │
│ Prefork ....... Disabled PID .............. 1887 │
└───────────────────────────────────────────────────┘
time=2024-06-02T14:19:57.540Z level=DEBUG msg="GET / mime:*/* agent:curl/7.68.0"
^Ctime=2024-06-02T14:26:40.777Z level=INFO msg="Gracefully shutting down HTTP server"
vagrant@ubuntu-focal:~$ ^C
vagrant@ubuntu-focal:~$ sudo ufw allow 8080/tcp
Rules updated
Rules updated (v6)
vagrant@ubuntu-focal:~$ ./vagrant_data/webservice
┌───────────────────────────────────────────────────┐
│ webservice │
│ Fiber v2.51.0 │
│ http://127.0.0.1:3000 │
│ │
│ Handlers ............ 27 Processes ........... 1 │
│ Prefork ....... Disabled PID .............. 2192 │
└───────────────────────────────────────────────────┘
time=2024-06-02T14:27:51.768Z level=DEBUG msg="GET / mime:*/* agent:curl/7.68.0"
^Ctime=2024-06-02T14:30:28.596Z level=INFO msg="Gracefully shutting down HTTP server"
vagrant@ubuntu-focal:~$ ^C
vagrant@ubuntu-focal:~$ exit
logout
Connection to 127.0.0.1 closed.
C:\Users\lucad\lucadVM>vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'ubuntu/focal64' version '20240524.0.0' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 3000 (guest) => 8080 (host) (adapter 1)
default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2222
default: SSH username: vagrant
default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 6.1.50
default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
default: /vagrant => C:/Users/lucad/lucadVM
default: /home/vagrant/vagrant_data => C:/Users/lucad/lucadVM
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
C:\Users\lucad\lucadVM>vargrant ssh
Der Befehl "vargrant" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.
C:\Users\lucad\lucadVM>vagrant ssh
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-182-generic x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/pro
System information as of Sun Jun 2 14:31:53 UTC 2024
System load: 0.62 Processes: 121
Usage of /: 3.6% of 38.70GB Users logged in: 0
Memory usage: 19% IPv4 address for enp0s3: 10.0.2.15
Swap usage: 0%
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.3 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Sun Jun 2 14:27:28 2024 from 10.0.2.2
^Avagrant@ubuntu-focal:~$ ./vagrant_data/webservice
┌───────────────────────────────────────────────────┐
│ webservice │
│ Fiber v2.51.0 │
│ http://127.0.0.1:3000 │
│ │
│ Handlers ............ 27 Processes ........... 1 │
│ Prefork ....... Disabled PID .............. 1307 │
└───────────────────────────────────────────────────┘
^Ctime=2024-06-02T14:33:15.208Z level=INFO msg="Gracefully shutting down HTTP server"
^Ctime=2024-06-02T14:33:15.328Z level=INFO msg="Gracefully shutting down HTTP server"
vagrant@ubuntu-focal:~$ exit
logout
Connection to 127.0.0.1 closed.
1.5:2648619a-19a5-4e34-a965-5f627deadc3e
\ No newline at end of file
1725704898
\ No newline at end of file
{"name":"ubuntu/jammy64","version":"20240823.0.1","provider":"virtualbox","directory":"boxes/ubuntu-VAGRANTSLASH-jammy64/20240823.0.1/virtualbox"}
\ No newline at end of file
1000
\ No newline at end of file
2648619a-19a5-4e34-a965-5f627deadc3e
\ No newline at end of file
ce293571343240c598cd53a604069b04
\ No newline at end of file
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAA
AAtzc2gtZWQyNTUxOQAAACDD+sc3pF1oqZ6KmRIhtiRzBuJgFyzu1DDzuUiW
/nLSHgAAAJDPSnDAz0pwwAAAAAtzc2gtZWQyNTUxOQAAACDD+sc3pF1oqZ6K
mRIhtiRzBuJgFyzu1DDzuUiW/nLSHgAAAEBeTKHofZTHVjnJfMG4l4xaEYHt
41V5gw4417CZTqXczsP6xzekXWipnoqZEiG2JHMG4mAXLO7UMPO5SJb+ctIe
AAAAB3ZhZ3JhbnQBAgMEBQY=
-----END OPENSSH PRIVATE KEY-----
{"virtualbox":{"/home/vagrant/vagrant_data":{"guestpath":"/home/vagrant/vagrant_data","hostpath":"/home/lucad/Documents/webservice/Spin_up_a_virtual_machine_locally","disabled":false,"__vagrantfile":true},"/vagrant":{"guestpath":"/vagrant","hostpath":"/home/lucad/Documents/webservice/Spin_up_a_virtual_machine_locally","disabled":false,"__vagrantfile":true}}}
\ No newline at end of file
/home/lucad/Documents/webservice/Spin_up_a_virtual_machine_locally
\ No newline at end of file
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
# This file loads the proper rgloader/loader.rb file that comes packaged
# with Vagrant so that encoded files can properly run with Vagrant.
if ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"]
require File.expand_path(
"rgloader/loader", ENV["VAGRANT_INSTALLER_EMBEDDED_DIR"])
else
raise "Encoded files can't be read outside of the Vagrant installer."
end
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/jammy64"
config.vm.synced_folder "/home/lucad/Documents/webservice/Spin_up_a_virtual_machine_locally", "/home/vagrant/vagrant_data"
config.vm.network "forwarded_port", guest: 3000, host: 8080, host_ip: "127.0.0.1", auto_correct: true
end
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment