Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding docker file for PyCharm docker interpreter, adding docs #3778

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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. opensource@allegro.pl"
LABEL authors="Allegro.pl Sp. z o.o. and Contributors opensource@allegro.pl"
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