Skip to content

Commit

Permalink
Adding docker file for PyCharm docker interpreter, adding docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Havelock-Vetinari committed Jun 29, 2023
1 parent 4029cb2 commit c3f1097
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docker/Dockerfile-local-interpreter
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:bionic

ENV DEBIAN_FRONTEND=noninteractive

# Ralph configuration and paths
ARG RALPH_LOCAL_DIR="/var/local/ralph"
ARG RALPH_VERSION=""
ARG SNAPSHOT="0"
ENV PATH=/opt/ralph/ralph-core/bin/:$PATH
ENV RALPH_CONF_DIR="/etc/ralph"
ENV RALPH_LOCAL_DIR="$RALPH_LOCAL_DIR"
ENV RALPH_IMAGE_TMP_DIR="/tmp"

LABEL maintainer="Allegro.pl Sp. z o.o. [email protected]"
LABEL authors="Allegro.pl Sp. z o.o. and Contributors [email protected]"
LABEL description="Advanced Asset Management and DCIM system for data center and back office."
LABEL version="$RALPH_VERSION"

RUN echo 'Acquire::Retries "5";' > /etc/apt/apt.conf.d/80-retries

RUN apt-get clean && \
apt-get update && \
apt-get -y install --no-install-recommends ca-certificates

RUN sed 's@http://archive.ubuntu.com@https://ftp.uni-mainz.de/ubuntu@' -i /etc/apt/sources.list

RUN apt-get clean && \
apt-get update && \
apt-get -y install \
apt-transport-https gnupg2 locales curl \
python3 python3-dev python3-pip python3-setuptools git libldap2-dev libsasl2-dev \
libffi-dev nodejs npm \
libmysqlclient-dev=5.7.21-1ubuntu1 libmysqlclient20=5.7.21-1ubuntu1 && \
rm -rf /var/lib/apt/lists/*

# set UTF-8 locale
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN mkdir -p $RALPH_LOCAL_DIR
COPY . $RALPH_LOCAL_DIR
WORKDIR $RALPH_LOCAL_DIR
RUN pip3 install -r $RALPH_LOCAL_DIR/requirements/dev.txt
34 changes: 34 additions & 0 deletions docs/development/docker_development_environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Ralph development environment

## Requirements

Make sure your host has the following requirements installed and
properly configured, if required:

1. Docker 24.0.0 or later
1. docker-compose

## Setting up Ralph in PyCharm IDE

From **Settings... -> Project: ralph -> Project Interpreters** choose **Add Interpreter -> On Docker**

Choose docker/Dockerfile-local-interpreter as Dockerfile and change context to "."

If you are using non amd64 architecture (ie. Apple Silicon), under Options -> Build options: add ```--platform linux/amd64```. Keep in mind, that this requires amd64 emulation in your docker environment.

![setup_dockerfile.png](img%2Fsetup_dockerfile.png)

After clicking Next, image should be successfully created and next step should provide you with proper path to interpreter:

![setup_docker_path.png](img%2Fsetup_docker_path.png)

Properly created environment should show all packages required by Ralph:

![setup_done.png](img%2Fsetup_done.png)

## Running local instance of Ralph from source code

To run local Ralph from source code using docker-compose issue this command:
```docker-compose -f docker/docker-compose-local-dev.yml up```

All required services should be started and your local ralph instance should be accessible on http://localhost:8000
Binary file added docs/development/img/setup_docker_path.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/development/img/setup_dockerfile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/development/img/setup_done.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ nav:
- Developer guide:
- Before you start: CONTRIBUTING.md
- Development environment: development/development_environment.md
- Docker Development environment [experimental]: development/docker_development_environment.md
- Architecture: development/overview.md
- RalphAdmin: development/admin.md
- Custom fields: development/custom_fields.md
Expand Down

0 comments on commit c3f1097

Please sign in to comment.