Skip to content

Instantly share code, notes, and snippets.

@Khnaz35
Last active October 29, 2023 16:50
Show Gist options
  • Save Khnaz35/26873309e143677d2b6c1f45a11fe428 to your computer and use it in GitHub Desktop.
Save Khnaz35/26873309e143677d2b6c1f45a11fe428 to your computer and use it in GitHub Desktop.

OpenCart Deployment and Management Guide

Introduction

This guide provides step-by-step instructions on how to deploy OpenCart using Docker, access and manage the MariaDB database, and update the administrator password for OpenCart.

Prerequisites

1. Deploy OpenCart using Docker

  1. Pull OpenCart and MariaDB Images from official bitnami container: Simply run this command in terminal.
curl -sSL https://raw.githubusercontent.com/bitnami/containers/main/bitnami/opencart/docker-compose.yml > docker-compose.yml
docker-compose up -d    

2. Access OpenCart

  • Web Interface: OpenCart will be accessible at http://localhost/.

3. Managing MariaDB Database

  1. Accessing the MariaDB Container: Run the following command to access the MariaDB container:

    docker exec -it <mariadb-container-name> /bin/bash

    Replace <mariadb-container-name> with the actual name of your MariaDB container.

  2. Accessing the MariaDB Console: Once inside the container, connect to the MariaDB database:

    mysql -u bn_opencart -p

    When prompted, enter the password. default image doesn't have password so simply enter

  3. Changing the Administrator Password:

    a. Select the OpenCart database:

    USE bitnami_opencart;

    b. Update the administrator password (replace new_password with the actual new password):

    UPDATE oc_user SET password = MD5('new_password') WHERE username = 'user';
  4. Exit the MariaDB Console: Type exit; and press Enter.

4. Cleaning Up

To stop and remove all containers, networks, and volumes defined in the docker-compose.yml file, navigate to the directory containing the file and run:

docker-compose down -v

Conclusion

You have successfully deployed OpenCart using Docker, accessed the MariaDB database, and updated the administrator password. OpenCart is now ready for use. Ensure to follow best practices for production deployments, such as securing the database and using strong, securely hashed passwords.

@ovicko
Copy link

ovicko commented Oct 28, 2023

please add phpmyadmin, to help manage database directly

@Khnaz35
Copy link
Author

Khnaz35 commented Oct 29, 2023

Hello @ovicko, this guide provides comprehensive instructions based on the official Bitnami OpenCart image. Should you require a custom image, feel free to follow the steps outlined here to create one tailored to your needs: bitnami/opencart.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment