GithubHelp home page GithubHelp logo

cli's Introduction

Ymir CLI

The Ymir command-line tool.

Requirements

  • PHP >= 7.2.5

Installation

Install the Ymir CLI in your project using composer:

$ composer require ymirapp/cli

Or globally:

$ composer global require ymirapp/cli

Contributing

Install dependencies using composer:

$ composer install

Links

cli's People

Contributors

carlalexander avatar github-actions[bot] avatar markjaquith avatar rjocoleman avatar moynzzz avatar tomhatzer avatar

Stargazers

Dave Bernier avatar David mattei avatar Dominik avatar Alex Monroy avatar Rudger avatar Dominik D. Geyer avatar Roberto Oriani avatar Osaigbovo Emmanuel avatar Sun Feng avatar  avatar  avatar Eduardo Pittol avatar Mateus Roveda avatar Uros Gruber avatar Andrew Marin avatar Nicholas avatar Yoren Chang avatar Ashley Rich avatar  avatar Vlad Olaru avatar Josh Pollock avatar Pierre Tondereau avatar Gabriel Albuquerque avatar Henning Orth avatar

Watchers

 avatar James Cloos avatar Yogesh Beniwal avatar  avatar

cli's Issues

Unable to delete network by ID

If I do ymir network:list and then ymir network:delete 7 where 7 is the Id shown in the list output, I get:

Unable to find a network with "7" as the ID or name

Deleting with the Name works, and calling ymir network:delete and then choosing from the list also works.

Docker dev with php 8.3 - Errors with cli

Hi!
First of all, I think this project is quite awesome. I already use bref for some laravel projects, and I am quite excited to have the same possibility with wp.

Sadly, I get some errors with the cli. Was able to init the project, but cannot setup either dns zone or ssl. I get this error, though domain is indeed specified (ymir certificate:request mydomain.com)

  The Ymir API responded with errors:   
                                        
      * The domains field is required.  

I also have a warning saying a new version is available, but I just installed globally using composer (in the container).
ymir --version returns Ymir 1.6.2

Here is my dockerfile for development:

# Use an official PHP runtime as a parent image
FROM php:8.3-apache

# Set the working directory
WORKDIR /var/www/html

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/


# Install system dependencies
RUN apt-get clean && apt-get update && apt-get install -y \
    git \
    zip \
    unzip \
    curl \
    default-mysql-client

RUN install-php-extensions gd xdebug zip mysqli

# Install Composer
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Install AWS CLI
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
    unzip awscliv2.zip && \
    ./aws/install

# Install Ymir CLI
RUN composer global require ymirapp/cli
RUN export PATH="$PATH:$HOME/.composer/vendor/bin"

# Enable Apache mod_rewrite
RUN a2enmod rewrite

#install wordpress cli
RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \
    chmod +x wp-cli.phar && \
    mv wp-cli.phar /usr/local/bin/wp

# create dev user
RUN useradd -m -s /bin/bash dev

# Copy the current directory contents into the container at /var/www/html
COPY . /var/www/html

# Make port 80 available to the world outside this container
EXPOSE 80

# Start Apache in the foreground
CMD ["apache2-foreground"]

Here is the docker-compose file :

version: '3.8'

services:
  web:
    build: ./docker
    volumes:
      - .:/var/www/html
    ports:
      - "8080:80"
    depends_on:
      - db
    environment:
      - DB_HOST=db
      - DB_USER=root
      - DB_PASSWORD=secret
      - DB_NAME=wordpress
    command: /bin/bash -c "apache2-foreground"
  db:
    image: mysql:8.3
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: secret
      MYSQL_DATABASE: wordpress
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:

Any insight would be appreciated, thanks!

Running wp CLI commands is awkward

Works:

  • ymir wp "user list"

Does not work:

  • ymir wp user list
  • ymir wp -- user list

Having to quote the WordPress command is incredibly awkward. Imagine commands which themselves have to be quoted.

When I use Pantheon's Terminus tool (a CLI for interacting with their hosting platform) I can do terminus remote:wp sitename.live -- user list. The -- there signifies "I'm done passing options to terminus, and the rest of everything should be passed to wp on the remote host" and is quite handy.

Option to turn off Cloudwatch logging.

It would be good to have a setting to turn off Cloudwatch logging if we use different services like Axiom to send logs.

I've tried to remove the permissions manually from the Role that the Lambda function uses, i.e.:

                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents",

But they are added back at each new deployment.

Unable to delete or update providers

If you fumble your AWS credentials (or expire them), you'll be stuck with an unusable provider. Would be nice to be able to update the credentials.

consider dockerignore on build step

Seems like when the image deployment is used, and if we have a .dockerignore file on the project root, that file is not copied to the .ymir/build directory where the build is happening.

The .dockerignore file is useful to add files that can be ignored on the builded image. It might be similar to #16 but is not related to s3 upload and to the resulting build image.

[QoL] validate project name on first step

I went through most of the init wizard until trying to create the database prefix when the Ymir API responded with an error that my project name has an underscore in it.

Expected would be to validate the project name string at the first step

image

CDN Failed

hello,
I have carried out multiple tests: changing the region, installing WordPress from scratch, etc., but always after running ymir init it shows that CDN failed, but I have no way to see why and when I check the AWS account I actually see that I don't believe it, nothing in CloudFront, despite this I have tried to continue with the deployment but some type of error always appears that I consider has to do with this.

$ ymir info
 ---------- ------------------- 
  Name       inspreb            
  Provider   Ymir Web Insp Reb  
  Region     us-east-1          
 ---------- ------------------- 

Listing information on all environments found in ymir.yml file
 --------------- ------------------------------------------------------------ 
  Name            production                                                  
  Domain          calm-badlands-qy9w2btfsz03.ymirsites.com                    
  HTTP Gateway    xtqb5234v0.execute-api.us-east-1.amazonaws.com              
  CDN             Failed                                                      
  Public assets   ymir-inspreb-production-assets-1705407277.s3.amazonaws.com  
  Database        Provisioning                                                
 --------------- ------------------------------------------------------------ 

 --------------- --------------------------------------------------------- 
  Name            staging                                                  
  Domain          ancient-cove-oynxdhurfhqz.ymirsites.com                  
  HTTP Gateway    lao205yoa9.execute-api.us-east-1.amazonaws.com           
  CDN             Failed                                                   
  Public assets   ymir-inspreb-staging-assets-1705407277.s3.amazonaws.com  
  Database        Provisioning                                             
 --------------- --------------------------------------------------------- 

Remove useless files from S3 upload

To save some time (and costs!) it'd be great if ymir was ignoring files that are not necessary for to go the S3 and unfortunately included in some plugins.

Including:

  • *.ts
  • *.tsx
  • *.scss
  • *.DS_store
  • node_modules**

`import:uploads` sftp doesn't support ed25519 keys

When using sftp import:uploads parses a url, sends it to League\Flysystem\PhpseclibV2\SftpConnectionProvider

PhpseclibV2 doesn't support ed25519 keys. The logic in SftpConnectionProvider is to use an agent unless opt'd out (7th parameter of SftpConnectionProvider).

I suggest two workarounds:

1.) if password is specified set useAgent = false.

2.) add an additional cli argument to disable agent.

PhpseclibV3 support is also available. I haven't looked into it (unsure about backwards compat).

thephpleague/flysystem#1261

I'll open a PR for workaround 1 as it seems sane to me. Of course both of these only handle the case where password access is available!

Add better messaging when SSL certs are not found

I have 18 domains mapped to this environment. I am attempting to deploy it, but it can't find a SSL cert. Well... I don't know which of the 18 domains it's having a fit about. This error message should be more clear about what is failing.

➜  garman git:(ymir) ✗ ymir deploy production
A new version of the Ymir CLI is available: 1.39.1 → 1.42.0
Project ymir.yml file is valid
Building project
  > Copying WordPress files
  > Downloading WP-CLI
  > Executing build commands
  > Ensuring Ymir plugin is installed
  > Copying Ymir must-use plugin
  > Extracting asset files
  > Compressing build files
Project built successfully
Uploading build (100%)
Processing assets
  > Getting signed asset URLs
  > Uploading new asset files (2954/2954)
Deployment starting
  > Ensuring cache table exists
  > Ensuring email domains exist
  > Ensuring environment role exists
  > Ensuring functions exist
  > Configuring environment image processing function
  > Configuring network
  > Preparing domain names
  > Assigning SSL certificate


  Deployment failed with error message:

  	No certificate found on cloud provider

[QoL] wp search-replace alias

Since Ymir already knows the domains (ymirsites or not) for a given environment, it'd be great if we could have a shortcut that allows for search replace in the target database.

WP media regenerate command just seems to break

Added a thumbnail size, which means I need to regenerate thumbnails. I tried running the CLI command, but it failed, and the logs aren't really that enlightening.

➜  garman git:(ymir) ✗ ymir wp --environment staging
A new version of the Ymir CLI is available: 1.39.1 → 1.42.0

 Please enter the WP-CLI command to run:
 > --url=mindsize.staging.garman.dev media regenerate --only-missing --yes

Running "wp --url=mindsize.staging.garman.dev media regenerate --only-missing --yes" on "staging" environment


  Running the command failed


wp [--environment ENVIRONMENT] [--async] [--] [<wp-command>...]

CleanShot 2023-09-12 at 11 01 37@2x

allow attaching tags on the resource created/manged by Ymir

A useful enhancement for Ymir would be to automatically add tags to resources based on the project and environment names. This feature would enable easy filtering of resources in the AWS cost explorer, allowing for more granular cost analysis by the project.

Copy Command ignores the vcs ignored files if those are present in build.include

Considering the following file structure and contents.

.gitignore

web/app/themes/*/
!web/app/themes/theme
node_modules

ymir.yml

...
    build:
      include:
        - web/app/themes/theme

When the copy is being done, if the theme folder has a node_modules folder, this is being added to the deployment, despite the fact the folder is being ignored on .gitignore.

I think this is happening because we include the build.include on the last step. https://github.com/ymirapp/cli/blob/main/src/Build/CopyWordPressFilesStep.php which copy over the gitignored files.

A possible solution that I see is to apply the $finder->ignoreVCSIgnored(true); at the very end.

This is currently causing the copy of thousands of node_modules files to s3.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.