Coder Social home page Coder Social logo

crud-laravel-demo's Introduction

Installing on Development server

Make sure you have 1GB of RAM on the server otherwise MySql container won't run!

  1. Install Docker and Docker Compose (see sections at the bottom).

  2. Copy files: Dockerfile, docker-compose.yml, .env to your environment by running the following commands:

curl --remote-name --location "https://raw.githubusercontent.com/vitalyspirin/crud-laravel-demo/master/docker/Dockerfile"

curl --remote-name --location "https://raw.githubusercontent.com/vitalyspirin/crud-laravel-demo/master/docker/docker-compose.yml"

curl --remote-name --location "https://raw.githubusercontent.com/vitalyspirin/crud-laravel-demo/master/docker/.env"
  1. Start development environment by running the following command:
docker-compose up

After that container maps ports 80 and 443. Open browser and type url of your server.

Installing on Production server

  1. Install Docker (see section at the bottom about how to install Docker).

  2. Copy file Dockerfile to your environment by executing command below:

curl --remote-name --location "https://raw.githubusercontent.com/vitalyspirin/crud-laravel-demo/master/docker/Dockerfile"
  1. Setup the database server and know database host, user name, user password and database name (make sure that user has appropriate DDL and DML permissions).

  2. Build and run your Docker image by executing the following commands (putting your values instead of _DB_HOST_, _DB_USERNAME, _DB_PASSWORD_, _DB_DATABASE_):

docker build --build-arg DIRECTORY_NAME=crud-laravel-demo --build-arg GIT_CLONE_URL=https://github.com/vitalyspirin/crud-laravel-demo.git -t trainium .

docker run -d --rm -p80:80 -p443:443 \
-e DB_HOST='_DB_HOST_' \
-e DB_USERNAME='_DB_USERNAME_' \
-e DB_PASSWORD='_DB_PASSWORD_' \
-e DB_DATABASE='_DB_DATABASE_' \
trainium
  1. If database is not populated then you can do it by running migrations through logging into Docker container:
  • Find container ID by running command docker ps.
  • Login into container by running command (putting above found ID instead of ID) docker -it exec _ID_ sh -l
  • Inside Docker container populate database by running command php artisan migrate:refresh --seed

After that container maps ports 80 and 443. Open browser and type url of your server. If you want to use HTTPS then make sure that you installed SSL certificate.

Installing Docker

If you are installing Docker on Amazon Linux then you can do it by running the following commands:

sudo yum -y install docker

sudo usermod -aG docker $USER

sudo service docker restart

docker --version

You need to relogin after that.

Installing Docker Compose

If you are installing Docker Compose on Amazon Linux then you can do it by running the following commands:

sudo curl -L https://github.com/docker/compose/releases/download/1.21.0/docker-compose-`uname -s`-`uname -m` | sudo tee /usr/local/bin/docker-compose > /dev/null

sudo chmod +x /usr/local/bin/docker-compose

sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

docker-compose --version

Useful commands:

Delete all Docker images, containers etc:

docker stop $(docker ps -a -q); docker rm $(docker ps -a -q); docker volume prune --force; docker rmi --force $(docker images -q); docker network prune --force

crud-laravel-demo's People

Contributors

vitaly-spirin avatar vitalyspirin avatar

Watchers

 avatar

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.