Skip to content

Commit

Permalink
Merge pull request #61 from pescaito-team/feature/vagrant
Browse files Browse the repository at this point in the history
feat(vagrant): implementado de Workflow CD de vagrant
  • Loading branch information
alesevbar authored Dec 17, 2024
2 parents 0db950a + 4c52320 commit a4ecf86
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 10 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/deployment_on_vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Vagrant Setup Workflow
on:
push:
branches: [main, develop, feature/vagrant]
pull_request:
branches: [main, develop, feature/vagrant]

jobs:
vagrant-deploy:
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Copy .env.example.vagrant to .env
run: |
cp .env.vagrant.example .env
- name: Navigate to /vagrant Directory
working-directory: ./vagrant
run: |
pwd
- name: Validate Vagrant Configuration
working-directory: ./vagrant
run: |
vagrant validate
- name: Start Vagrant Machine
working-directory: ./vagrant
run: |
vagrant up
- name: Check Application Status
working-directory: ./vagrant
run: |
echo "Waiting for the application to be accessible..."
sleep 10
curl -I http://localhost:5000 || echo "App not reachable"
- name: Output Connection Details
run: |
echo "Service is available at: http://localhost:5000"
16 changes: 8 additions & 8 deletions vagrant/02_install_mariadb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
state: started
enabled: yes

- name: Change default MariaDB password
become: yes
- name: Change default MariaDB root password
mysql_user:
login_unix_socket: /run/mysqld/mysqld.sock
login_user: 'root'
login_password: ''
name: 'root'
password: '{{ mariadb_root_password }}'
state: present
name: root
host: localhost
password: "{{ mariadb_root_password }}"
login_unix_socket: /var/run/mysqld/mysqld.sock
check_implicit_admin: yes
become: yes



- name: Create SQL script
Expand Down
1 change: 0 additions & 1 deletion vagrant/04_install_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
name:
- python3.12
- python3.12-venv
- python3.12-distutils
- mariadb-client
state: present

Expand Down
3 changes: 2 additions & 1 deletion vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def load_env(file)
end

# Load .env file from the top level and get the loaded variables
env_file_path = File.expand_path("../../.env", __FILE__)
env_file_path = File.expand_path("../.env", __dir__)
puts "Loading .env file from: #{env_file_path}"
loaded_env_vars = load_env(env_file_path)

Expand Down Expand Up @@ -84,5 +84,6 @@ Vagrant.configure("2") do |config|
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
vb.cpus = 4
vb.gui = true
end
end

0 comments on commit a4ecf86

Please sign in to comment.