Code Monkey home page Code Monkey logo

shopifyasst's Introduction

Uploader for CityStock Shopify App

Description

This script is meant to upload images to Shopify and all dependent third-party plugins. Once installed on a VM in AWS EC2, this script will cycle through the citystock-uploader-kevin bucket, create a Shopify product from the image metadata, upload the asset to the third-party plugin, and then link the asset to the Shopify product. The shell script that uploads images will only work on a Linux machine. The installation instructions below only apply to Ubuntu, but may be applicable to any Unix-like system that has the exiftool available.

Installation

Create VM

We will create a VM to perform the uploads for two reasons. The first is that a pristine runtime environment is easier to guarantee on a dedicated VM than it would be on a contributor's personal machine. The second is that the VM is in the AWS network and thus has extremely fast connectivity.

Inside of the AWS console, create an EC2 instance:

  • Name: uploader (NOTE: if you change this, ensure that the change is reflected in later steps that use 'INSTANCE_NAME')
  • Image: Ubuntu 22.04 (or higher)
  • SSH Keys: brians_gram
  • VPC: Cluster-VPC
  • Subnet: Public-Subnet-1
  • Auto-Assign Public IP: Enable
  • Security Group: ssh-anywhere

Inside of the AWS console, create an IAM user for the EC2 instance:

  • Access Type: Programmatic access
  • Name: uploader
  • Role: S3-Admin
  • Region: us-east-1 (used in aws configure)

Set Up VM

From host:

INSTANCE_NAME='uploader'
INSTANCES="$(aws ec2 describe-instances --filters Name=tag:Name,Values="$INSTANCE_NAME")"
INSTANCE_IP_ADDR="$(echo $INSTANCES | jq '.Reservations[0].Instances[0].PublicIpAddress' | tr -d '"')"
ssh -i ~/.ssh/brians_gram.pem ubuntu@$INSTANCE_IP_ADDR

From VM:

sudo apt update
sudo apt upgrade -y
sudo reboot
# log back in as before
sudo apt install exiftool awscli golang python3.10-venv python3-pip imagemagick ffmpeg
aws configure # provide access key and pw from console
# clone repo
git clone https://github.com/briand787b/shopifyasst.git
cd shopifyasst
# set up secret env vars
cp example.env .env # fill in secret values
# install py deps.  You may want to create a venv before this
cd py
python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
# install node dependencies
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
nvm install 18
cd node
npm install

How to Run

# if you did not compile go binary yet
./main.sh --recompile

# otherwise
./main.sh

shopifyasst's People

Contributors

briand787b avatar

Watchers

 avatar

Forkers

bd250227

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.