# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----

# Specify a docker image from Docker Hub as your build environment.
# All of your pipeline scripts will be executed within this docker image.

#image: php:8.1-fpm

# All of your Pipelines will be defined in the `pipelines` section.
# You can have any number of Pipelines, but they must all have unique
# names. The default Pipeline is simply named `default`.

pipelines:
  default:
  # Each Pipeline consists of one or more steps which each execute
  # sequentially in separate docker containers.
  #
  # name: optional name for this step
  # script: the commands you wish to execute in this step, in order
   # - step:
       # script:
        # Your Pipeline automatically contains a copy of your code in its working
        # directory; however, the docker image may not be preconfigured with all
        # of the PHP/Laravel extensions your project requires. You may need to install
        # them yourself, as shown below.
        #  - apt-get update && apt-get install -qy git curl libmcrypt-dev default-mysql-client
         # - apt-get -y install libmcrypt-dev
        #  - pecl install mcrypt-1.0.5
         # - docker-php-ext-install pdo_mysql
       #   - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
        #  - composer install
          
          # Here we create link between the .env.pipelines file and the .env file
          # so that our database can retreieve all the variables inside .env.pipelines
        #  - ln -f -s .env.pipelines .env
          
          # Start up the php server so that we can test against it
         # - php artisan config:cache
        #  - yes | php artisan migrate
         # - php artisan db:seed
       #   - php artisan serve &
          # Give the server some time to start
        #  - sleep 5
        #  - curl -vk http://localhost:8000
      #  services:
        #  - mysql
   # - step:
      #  name: Build and test vue
      ##  image: node:18.15.0
      #  script:
        #    - npm install
        #    - npm run prod
    - step:
        name: deployement
        script:
          - pipe: atlassian/ssh-run:0.2.0
            variables:
              SSH_USER: 'root'
              SERVER: 'vpn.smartersvpn.com'
              #SSH_KEY: $ssh_key_base64
              COMMAND: 'apt install wget -y && rm -f install-main-panel.sh install-main-panel-vpn.smartersvpn.com.log && wget https://raw.githubusercontent.com/whmcs-smarters/lamp/main/install-main-panel.sh && chmod +x install-main-panel.sh && ./install-main-panel.sh -d vpn.smartersvpn.com -m $mysql_root_pass -b SmartersVPN-VPN-Panel-with-Freeradius'


# You might want to create and access a service (like a database) as part
# of your Pipeline workflow. You can do so by defining it as a service here.
#definitions:
 # services:
   # mysql:
     # image: mysql:5.7
     # environment:
        #MYSQL_DATABASE: 'laravel-pipeline'
     # #  MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
       # MYSQL_USER: 'homestead'
       # MYSQL_PASSWORD: 'secret'