This README will guide you through setting up the Bit Integration Shopify App. Follow the steps below to get the project running on your local machine.
Ensure you have the following installed on your machine:
- PHP (>= 8.2)
- Redis extension (if you want to use Redis as the queue connection)
- Nginx
- PostgreSQL (>= 14)
- ngrok (for local HTTPS tunneling)
- nginx
- app
- web
- worker
- database
- redis
- certbot
- mailhog
- Docker
- Docker Compose
To stop and remove all Docker containers, you can run the following commands:
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
-
Clone the Bit-integrations-Docker project and navigate to the project directory:
HTTPS:
git clone https://github.com/JoulesLabs/bit-integrations-docker.git cd bit-integrations-docker
SSH:
git clone [email protected]:JoulesLabs/bit-integrations-docker.git cd bit-integrations-docker
The project structure looks like this:
bit-integrations-docker
├── .docker
├── app
│ └── all app files
├── web
│ └── all web files
├── .dockerignore
├── .gitignore
├── .env
├── docker-compose.yml.example
├── README.md
└── make-ssl.sh.example
Create a .env
file in the root directory of your project by copying from the .env.example
file and set the following environment variables:
cp .env.example .env
Then, open the .env
file and set the following environment variables:
SHOPIFY_APP_NAME="Bit Integration"
SHOPIFY_API_VERSION=2024-04
SHOPIFY_API_KEY=
SHOPIFY_API_SECRET=
SHOPIFY_API_SCOPES=read_orders,read_products,read_themes,read_customers,read_content,write_content,read_locales
SHOPIFY_API_REDIRECT=/back/authenticate
WEBHOOKS_JOB_QUEUE=webhook
-
Clone the repository:
git clone https://github.com/yourusername/bit-integrations.git git clone https://github.com/yourusername/bit-web.git cd app cp .env.example .env cd web cp .env.example .env docker-compose up -d build
-
Install PHP dependencies:
Using Composer:
docker-compose app composer install
-
Set up PostgreSQL:
Ensure PostgreSQL is running and create a new database for the project. Update your
.env
file with the database connection details:DB_CONNECTION=pgsql DB_HOST=127.0.0.1 DB_PORT=5432 DB_DATABASE=your_database_name DB_USERNAME=your_database_user DB_PASSWORD=your_database_password
-
Run database migrations:
docker-compose app php artisan migrate
-
Seed the database:
docker-compose app php artisan db:seed
-
Set up Redis (if using Redis for queues):
Ensure Redis is running and update your
.env
file to configure the queue connection:QUEUE_CONNECTION=redis
-
Set up ngrok:
Start an ngrok tunnel to forward HTTP traffic to your local server:
ngrok http 8000
Note the forwarding URL provided by ngrok (e.g.,
https://abcd1234.ngrok.io
), as you will need it in the next step. -
Configure Shopify App URL:
Update your app settings in the Shopify Partner Dashboard with the ngrok URL. Set the App URL and Redirect URLs to match the ngrok forwarding URL.
-
Start the development server:
Using Artisan:
php artisan serve
The app uses webhooks to handle various Shopify events. The WEBHOOKS_JOB_QUEUE
environment variable defines the queue for webhook jobs. Ensure your job processing system is configured to handle this queue.
- Replace
https://github.com/yourusername/yourrepository.git
with your actual repository URL. - Adjust the directory structure and paths in the instructions if they differ.
- Add more sections as needed, such as Troubleshooting, FAQ, Credits, or Contact.