Sign inSign up

pcourbin/pl

By pcourbin

•Updated over 6 years ago

Image
0

134

pcourbin/pl repository overview

⁠Use PremierLangage⁠ in a Docker

This repository is a simple fork of the PremierLangage⁠ great project to which a dockering procedure has simply been added. You can quickly deploy:

  • A completely dockerized version of the project, especially for testing
  • A development environment using the docker containing all the necessary libraries.

Please, refer to the original Github repository⁠ and the original demo site⁠ for more details.

⁠Getting Started

⁠Prerequisities

In order to run this container you'll need docker installed.

⁠Quickstart

This docker image is based on python:3⁠. It includes the packages needed to run PremierLangage⁠ (Especially Django⁠). All the code for this repository is copied to the docker in the folder /usr/src/app.

To run a simple example, you can use the file docker-compose.yml

version: '3'
services:
  pl:
    image: pcourbin/pl:0.7.1
    environment:
      - PL_ENV_TYPE=local
      - DATABASE_HOST=pg
      - DATABASE_USERNAME=pl
      - DATABASE_PASSWORD=plpassword
      - ALLOWED_HOSTS=*
      - SECRET_KEY=mygreatsupersecretkey
    ports:
      - 8000:8000
    links:
      - pg

  pg:
    image: postgres
    environment:
      - POSTGRES_USER=pl
      - POSTGRES_PASSWORD=plpassword
      - POSTGRES_DB=django_premierlangage

and run

docker-compose up

Then, go to http://localhost:8000⁠ and use super user credentials:

  • login: admin
  • password: adminadmin

⁠Environment Variables

NameDefaultPossibles valuesDescription
PL_ENV_TYPEdblocal, release, dbSee details below
PL_STATIC_FILEStruetrue, falseCollect static files. See details in Django documentation⁠
DATABASE_HOST127.0.0.1*Host of the postgresql database
DATABASE_PORT5432*Port of the postgresql database
DATABASE_NAMEdjango_premierlangage*Name of the postgresql database
DATABASE_USERNAMEdjango*Username of the postgresql database which has access to the DATABASE_NAME postgresql database
DATABASE_PASSWORDdjango_password*Password of DATABASE_USERNAME
SANDBOX_URLhttp://127.0.0.1:7000/sandbox*See specific Github repository of PremierLangage Sandbox⁠ for details.
ALLOWED_HOSTS127.0.0.1*Configuration of the allowed hosts of Django. See details in Django documentation⁠
SECRET_KEYdefaultsecretkey*Configuration of the secret key for a particular Django installation. See details in Django documentation⁠
⁠PL_ENV_TYPE options
ValueDescriptionUsers (login/password)
dbOnly deploy the docker without any database initialisation. (if you already have your own filled database).See your database.
localDeploy a quick version with default user. script\fill_database_local.py is run at first startup.admin/adminadmin
releaseDeploy a quick version without default. script\fill_database_release.py is run at first startup.Run python3 manage.py createsuperuser in your docker to create admin user.

⁠Example : Run release version

To run a simple example, you can use the file docker-compose.yml and edit PL_ENV_TYPEto release

version: '3'
services:
  pl:
    image: pcourbin/pl:0.7.1
    environment:
      - PL_ENV_TYPE=release
      - DATABASE_HOST=pg
      - DATABASE_USERNAME=pl
      - DATABASE_PASSWORD=plpassword
      - ALLOWED_HOSTS=*
      - SECRET_KEY=mygreatsupersecretkey
    ports:
      - 8000:8000
    links:
      - pg

  pg:
    image: postgres
    environment:
      - POSTGRES_USER=pl
      - POSTGRES_PASSWORD=plpassword
      - POSTGRES_DB=django_premierlangage

then run

docker-compose up

next, you need to create an admin user with:

docker-compose exec pl python3 manage.py createsuperuser

Then, go to http://localhost:8000⁠ and use your user credentials.

⁠Example : Run development version

To run a dockerized version of the environment but using your code as application :

  1. Run the script docker-dev-prepare.shwhich will download some librairies with pip
  2. Use the file docker-compose-dev.yml which mount the current folder as the application folder /usr/src/app
  3. If needed, you can then create your own dockerized version using docker-compose -f docker-compose-dev.yml build

Tag summary

Content type

Image

Digest

Size

507.6 MB

Last updated

over 6 years ago

docker pull pcourbin/pl:0.7.1