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

Mass change of the name to logdetective #169

Merged
merged 1 commit into from
Sep 26, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:

env:
REGISTRY: quay.io
IMAGE_NAME: log-detective/website
IMAGE_NAME: logdetective/website


jobs:
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
COMPOSE ?= $(shell command -v podman-compose 2> /dev/null || echo docker-compose)
CONTAINER_ENGINE ?= $(shell command -v podman 2> /dev/null || echo docker)
TEST_IMAGE_NAME=log-detective-website_test-backend
TEST_IMAGE_NAME=logdetective-website_test-backend
FEEDBACK_DIR=/persistent/results
REVIEWS_DIR=/persistent/reviews
PYTHONPATH=/opt/log-detective-website/backend
PYTHONPATH=/opt/logdetective-website/backend


build-prod:
Expand Down Expand Up @@ -31,6 +31,6 @@ test-backend-in-container:
-e FEEDBACK_DIR="$(FEEDBACK_DIR)" \
-e REVIEWS_DIR="$(REVIEWS_DIR)" \
-e ENV="devel" \
-v .:/opt/log-detective-website:z \
-v .:/opt/logdetective-website:z \
$(TEST_IMAGE_NAME) \
bash -c "pytest -vvv /opt/log-detective-website/backend/tests/" \
bash -c "pytest -vvv /opt/logdetective-website/backend/tests/" \
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Log Detective website

Production instance: http://log-detective.com
Production instance: http://logdetective.com

## DEMO

Expand Down
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dnf install python3-fastapi python3-uvicorn
Run the development ASGI server with

```
PYTHONPATH=/opt/log-detective-website uvicorn api:app --host 0.0.0.0 --port 5020 --reload
PYTHONPATH=/opt/logdetective-website uvicorn api:app --host 0.0.0.0 --port 5020 --reload
```

or use compose:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ services:
build:
context: docker/production
dockerfile: Dockerfile
image: quay.io/log-detective/website
hostname: log-detective
image: quay.io/logdetective/website
hostname: logdetective
stdin_open: true
tty: true
ports:
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ services:
context: .
dockerfile: docker/backend/Dockerfile
hostname: backend
working_dir: /opt/log-detective-website/backend/src
working_dir: /opt/logdetective-website/backend/src
command: "uvicorn api:app --host 0.0.0.0 --port 5020"
stdin_open: true
tty: true
ports:
- 5020:5020
volumes:
- .:/opt/log-detective-website:z
- .:/opt/logdetective-website:z
- persistent:/persistent
env_file:
- "files/env"
environment:
- ENV=devel
- FEEDBACK_DIR=/persistent/results
- PYTHONPATH=/opt/log-detective-website/backend
- PYTHONPATH=/opt/logdetective-website/backend
# The frontend container is only a quality of life for development.
# For production, we will simply compile the ClojureScript into JavaScript
# and deploy it.
Expand All @@ -28,7 +28,7 @@ services:
context: .
dockerfile: docker/frontend/Dockerfile
hostname: frontend
working_dir: /opt/log-detective-website/frontend
working_dir: /opt/logdetective-website/frontend
command: >
bash -c "
npm install &&
Expand All @@ -41,7 +41,7 @@ services:
- 9630:9630
- 3333:3333
volumes:
- .:/opt/log-detective-website:z
- .:/opt/logdetective-website:z
env_file:
- "files/env"
environment:
Expand Down
2 changes: 1 addition & 1 deletion docker/frontend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN npm install -g shadow-cljs@">=2.26.0 <3.0.0"
# TODO In the next steps we want to copy the source code to the container,
# install all Javascript dependencies and pre-install all ClojureScript
# dependencies. However we want to make them available to the bind-mounted
# directory in /opt/log-detective-website that will be used when running the
# directory in /opt/logdetective-website that will be used when running the
# container. Unfortunatelly, I don't know how to do that, which makes running
# the container for the first time take a couple of minutes before it is ready.
# To whomever trying to fix this, here are some useful commands:
Expand Down
4 changes: 2 additions & 2 deletions docker/production/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN dnf -y update && \
java


RUN git clone https://github.com/fedora-copr/log-detective-website.git /src
RUN git clone https://github.com/fedora-copr/logdetective-website.git /src


WORKDIR /src/frontend
Expand Down Expand Up @@ -65,4 +65,4 @@ WORKDIR /src/backend/src
ENV PYTHONPATH="${PYTHONPATH}:/src/backend"

# We should put this into a config file
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--certfile", "/persistent/letsencrypt/live/log-detective.com/cert.pem", "--keyfile", "/persistent/letsencrypt/live/log-detective.com/privkey.pem", "--ca-certs", "/persistent/letsencrypt/live/log-detective.com/fullchain.pem", "api:app", "-b", "0.0.0.0:8080"]
CMD ["gunicorn", "-k", "uvicorn.workers.UvicornWorker", "--certfile", "/persistent/letsencrypt/live/logdetective.com/cert.pem", "--keyfile", "/persistent/letsencrypt/live/log-detective.com/privkey.pem", "--ca-certs", "/persistent/letsencrypt/live/log-detective.com/fullchain.pem", "api:app", "-b", "0.0.0.0:8080"]
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "log-detective-website",
"name": "logdetective-website",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions frontend/public/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<a
class="nav-link active"
aria-current="page"
href="https://github.com/fedora-copr/log-detective-website"
href="https://github.com/fedora-copr/logdetective-website"
>
Code
</a>
Expand All @@ -79,7 +79,7 @@
<a
class="nav-link active"
aria-current="page"
href="https://github.com/fedora-copr/log-detective-website/issues"
href="https://github.com/fedora-copr/logdetective-website/issues"
>
Issues
</a>
Expand Down
48 changes: 24 additions & 24 deletions openshift/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenShift deployment

At this time, the `log-detective` website is deployed in Fedora
At this time, the `logdetective` website is deployed in Fedora
CommuniShift.

- Dashboard: https://console-openshift-console.apps.fedora.cj14.p1.openshiftapps.com/
Expand All @@ -18,7 +18,7 @@ https://docs.okd.io/latest/cli_reference/openshift_cli/getting-started-cli.html

To be able to access the OpenShift project please ping fedora-infra to
add you to [communishift][group1] group and @FrostyX, to add you to
[communishift-log-detective][group2] group.
[communishift-logdetective][group2] group.

## Login

Expand All @@ -33,7 +33,7 @@ oc login --token=... --server=https://api.fedora.cj14.p1.openshiftapps.com:6443
## Build

The production container uses code from
https://github.com/fedora-copr/log-detective-website
https://github.com/fedora-copr/logdetective-website
so commit and push your changes.

Build the container image:
Expand All @@ -49,7 +49,7 @@ make build-prod
```

Push the image to quay.io
[quay.io/log-detective][quay-organization]:
[quay.io/logdetective][quay-organization]:

```
docker-compose -f docker-compose.prod.yaml push
Expand Down Expand Up @@ -77,27 +77,27 @@ This will also generate release notes.

Once you created the new release, you should wait for our GitHub action to
build a matching container image and push it to [our quay
repository](https://quay.io/repository/log-detective/website?tab=history).
repository](https://quay.io/repository/logdetective/website?tab=history).

When you see the image in the listing, continue with the regular Deploy process
described below.

You can then verify based on the Image digest what we are running production:
```
oc describe pod log-detective-website-xxxxxxxx-xxxxx | grep 'Image ID'
Image ID: quay.io/log-detective/website@sha256:71a5cf95568e593df8a0723081b4bd17506d2236bdb431d9149f00337add3376
oc describe pod logdetective-website-xxxxxxxx-xxxxx | grep 'Image ID'
Image ID: quay.io/logdetective/website@sha256:71a5cf95568e593df8a0723081b4bd17506d2236bdb431d9149f00337add3376
```

The Tag History shows these digests.

## Pull Image

Alternativelly you can use existing image.
Pre-build images are available at quay.io/log-detective, semantically versioned,
Pre-build images are available at quay.io/logdetective, semantically versioned,
with versions correponding to tags of this repo.

```bash
docker pull quay.io/log-detective/website:latest
docker pull quay.io/logdetective/website:latest
```

Images are build and pushed with every new tag by a github action.
Expand All @@ -108,34 +108,34 @@ Images are build and pushed with every new tag by a github action.
Make sure you are using the correct OpenShift project

```
oc project communishift-log-detective
oc project communishift-logdetective
```

If a Kubernetes/OpenShift configuration change needs to be applied,
run the following command. Otherwise you can skip it.

```
oc apply -f openshift/log-detective.yaml
oc apply -f openshift/logdetective.yaml
```

To kill the current deployment and start a fresh, up-to-date
container, run

```
oc rollout restart deploy/log-detective-website
oc rollout restart deploy/logdetective-website
```

You can debug the instance using

```
oc logs -f deploy/log-detective-website
oc logs -f deploy/logdetective-website
# or
oc rsh deploy/log-detective-website
oc rsh deploy/logdetective-website
```

[quay-organization]: https://quay.io/repository/log-detective/website
[quay-organization]: https://quay.io/repository/logdetective/website
[group1]: https://accounts.fedoraproject.org/group/communishift/
[group2]: https://accounts.fedoraproject.org/group/communishift-log-detective/
[group2]: https://accounts.fedoraproject.org/group/communishift-logdetective/


### Secrets
Expand All @@ -160,17 +160,17 @@ $ dnf install certbot

Run certbot in the root of this git repo.
```
$ certbot certonly --config-dir cert/ --work-dir cert/ --logs-dir cert/ --manual --preferred-challenges dns --email [email protected] -d '*.log-detective.com' -d '*.logdetective.com' -d 'log-detective.com' -d 'logdetective.com'
$ certbot certonly --config-dir cert/ --work-dir cert/ --logs-dir cert/ --manual --preferred-challenges dns --email [email protected] -d '*.logdetective.com' -d '*.logdetective.com' -d 'log-detective.com' -d 'logdetective.com'
```

We will create one certificate file that will contain data for both
log-detective.com and logdetective.com. With wildcards and naked. We need all
logdetective.com and logdetective.com. With wildcards and naked. We need all
these 4 entries to get https://log... and https://www... working.
```
Please deploy a DNS TXT record under the name:
```

Set those 2 TXT DNS entries for log-detective.com and logdetective.com
Set those 2 TXT DNS entries for logdetective.com and logdetective.com

Wait for those 2 entries to be up:
```
Expand All @@ -184,24 +184,24 @@ $ dig -t txt _acme-challenge.logdetective.com. @curitiba.ns.porkbun.com.

You can verify the newly created cert with `openssl` CLI. Here we check that both domains are set as SAN:
```
$ openssl x509 -inform pem -noout -text -in 'cert/live/log-detective.com/fullchain.pem'
$ openssl x509 -inform pem -noout -text -in 'cert/live/logdetective.com/fullchain.pem'
...
X509v3 Subject Alternative Name:
DNS:log-detective.com, DNS:logdetective.com
DNS:logdetective.com, DNS:logdetective.com
```

Once verified, you should delete those TXT DNS records.

All certificate stuff is in gitignored cert/ folder.

Copy the content to the running log-detective:
Copy the content to the running logdetective:
```
$ oc cp cert/ log-detective-website-$pod:/persistent
$ oc cp cert/ logdetective-website-$pod:/persistent
```

Connect to the pod, back up old certs and rename cert/ to letsencrypt/:
```
$ oc rsh deployment/log-detective-website
$ oc rsh deployment/logdetective-website

$ mv /persistent/letsencrypt{,-old}
$ mv /persistent/{cert,letsencrypt}
Expand Down
2 changes: 1 addition & 1 deletion openshift/dataset-cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: upload-dataset
image: quay.io/log-detective/website:latest
image: quay.io/logdetective/website:latest
imagePullPolicy: Always
# for some reason we need to explicitly call the command like this -_-
command: ["python3", "/usr/bin/compile_extraction_dataset.py"]
Expand Down
Loading
Loading