all repos — caroster @ eb701b6613d4a7a6c86f7adcf42341b4abc6726f

[Octree] Group carpool to your event https://caroster.io

👷 Use generic infra
Tim Izzo tim@octree.ch
Wed, 11 Oct 2023 16:00:36 +0200
commit

eb701b6613d4a7a6c86f7adcf42341b4abc6726f

parent

efb618469130ae351c648f97b4a1d6cac23525b3

10 files changed, 30 insertions(+), 147 deletions(-)

jump to
D .github/workflows/docker.yml

@@ -1,20 +0,0 @@

-name: Docker Build & Push -on: - push: - branches: - - main - -env: - USERNAME: octree - IMAGE_NAME: caroster - -jobs: - build-docker-image: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - run: docker login -u $USERNAME -p $PASSWORD - env: - PASSWORD: ${{secrets.DOCKER_HUB_PASSWORD}} - - run: docker build -t $USERNAME/$IMAGE_NAME . - - run: docker push $USERNAME/$IMAGE_NAME
M .gitlab-ci.yml.gitlab-ci.yml

@@ -1,3 +1,21 @@

include: - project: o/infra/templates file: /gitlab-ci/includes/StrapiBuildDeploy.yaml + +Push to Docker Hub: + stage: deploy + retry: 2 + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + rules: + - if: "$CI_COMMIT_TAG =~ /v.*$/" + - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH + when: manual + variables: + CI_REGISTRY_IMAGE: octree/caroster + script: + - echo "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"$DOCKER_HUB_AUTH\"}}}" > /kaniko/.docker/config.json + - "[[ -f VERSION.txt ]] && VERSION=$(cat VERSION.txt) || VERSION=${CI_COMMIT_TAG:-$CI_COMMIT_SHORT_SHA}" + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$VERSION --build-arg VERSION=$VERSION + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest --build-arg VERSION=$VERSION
M CONTRIBUTING.mdCONTRIBUTING.md

@@ -2,15 +2,15 @@ ## How to contribute to Caroster

#### **Did you find a bug?** -- **Do not open up a GitHub issue if the bug is a security vulnerability**, and instead to send an email to caroster@octree.ch. +- **Do not open up an issue if the bug is a security vulnerability**, and instead to send an email to caroster@octree.ch. -- **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/octree-gva/caroster/issues). +- **Ensure the bug was not already reported** by searching on GitLab under [Issues](https://git.octree.ch/p/caroster/-/issues). -- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/octree-gva/caroster/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. +- If you're unable to find an open issue addressing the problem, [open a new one](https://git.octree.ch/p/caroster/-/issues/new). Be sure to include a **title and clear description**, as much relevant information as possible, and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring. #### **Did you write a patch that fixes a bug?** -- Open a new GitHub pull request with the patch. +- Open a new GitLab merge request with the patch. - Ensure the PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

@@ -24,7 +24,7 @@ - Refer to [Weblate documentation](https://docs.weblate.org/en/latest/user/translating.html) to learn how to use Weblate.

#### **Do you intend to add a new feature or change an existing one?** -- Suggest your proposal by creating a [new issue](https://github.com/octree-gva/caroster/issues/new). +- Suggest your proposal by creating a [new issue](https://git.octree.ch/p/caroster/-/issues/new). - When your proposal has been accepted by a maintainer, write your code then create a Pull Request linked to your issue.
M DockerfileDockerfile

@@ -1,20 +1,4 @@

-FROM node:16-alpine - -VOLUME /srv/app/backend/node_modules -VOLUME /srv/app/backend/build -VOLUME /srv/app/backend/public/uploads -VOLUME /srv/app/frontend/node_modules -VOLUME /srv/app/frontend/.next - -EXPOSE 80 -WORKDIR /srv/app - -RUN apk add --no-cache nginx && yarn global add pm2 +FROM git.octree.ch:4567/o/infra/templates/base/strapi:nginx COPY ./frontend /srv/app/frontend -COPY ./backend /srv/app/backend -COPY ./ecosystem.config.js /srv/app/ -COPY ./nginx.conf /etc/nginx/http.d/default.conf -COPY ./docker-entrypoint.sh /usr/local/bin - -RUN chmod +x /usr/local/bin/docker-entrypoint.sh+COPY ./backend /srv/app/backend
M README.mdREADME.md

@@ -6,6 +6,8 @@ # Caroster - Group carpool to your event

Caroster is an easy and free app to organize group carpooling for an event, a party, a seminar, a sports event, a camp, a ski trip… +> Are you on GitHub ? Please use the [reference repository on GitLab](https://git.octree.ch/p/caroster) for issues and pull requests. + ## Getting Started These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

@@ -26,16 +28,16 @@

Clone the repo locally: ```shell -git clone https://github.com/octree-gva/caroster.git +git clone https://git.octree.ch/p/caroster.git cd caroster ``` ### Run with Docker -First, create containers with Docker-Compose: +First, create containers with Docker Compose: ```shell -docker-compose up +docker compose up ``` Wait a few minutes while the application downloads needed packages,
M backend/package.jsonbackend/package.json

@@ -5,7 +5,6 @@ "version": "0.1.0",

"description": "A Strapi application", "scripts": { "develop": "strapi develop", - "prestart": "yarn && yarn build", "start": "strapi start", "build": "strapi build", "strapi": "strapi",
D docker-entrypoint.sh

@@ -1,9 +0,0 @@

-#!/bin/sh - -# Start NGINX in daemon mode -grep -q -F "pid " /etc/nginx/nginx.conf || echo "pid /run/nginx.pid;" >> /etc/nginx/nginx.conf -nginx - -# Start NodeJS apps with PM2 -cd /srv/app -pm2-runtime start ecosystem.config.js
D ecosystem.config.js

@@ -1,25 +0,0 @@

-module.exports = { - apps: [ - { - name: "strapi", - cwd: "backend/", - script: "yarn", - args: "start", - interpreter: "sh", - restart_delay: 10000, - max_restarts: 10, - }, - { - name: "next", - cwd: "frontend/", - script: "yarn", - args: "start", - interpreter: "sh", - restart_delay: 10000, - env: { - PORT: 3000, - STRAPI_URL: `http://localhost:1337`, - }, - }, - ], -};
M frontend/package.jsonfrontend/package.json

@@ -5,7 +5,6 @@ "private": true,

"scripts": { "dev": "next dev", "build": "next build", - "prestart": "yarn && yarn build", "i18n-format": "sync-i18n --files 'locales/*.json' --primary en --newKeysEmpty true", "i18n-unused": "node i18n-unused", "start": "next start",
D nginx.conf

@@ -1,65 +0,0 @@

-upstream strapi { - server localhost:1337; -} - -upstream nextjs { - server localhost:3000; -} - -server { - listen 80 default_server; - listen [::]:80 default_server; - - access_log /var/log/nginx/access.log; - error_log /var/log/nginx/access.log; - - proxy_http_version 1.1; - proxy_set_header X-Forwarded-Host $host; - proxy_set_header X-Forwarded-Server $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header Host $host; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "Upgrade"; - proxy_pass_request_headers on; - - location /graphql { - proxy_pass http://strapi; - } - location /api { - proxy_pass http://strapi; - } - location /admin { - proxy_pass http://strapi; - } - location /i18n { - proxy_pass http://strapi; - } - location /content-manager { - proxy_pass http://strapi; - } - location /email-designer { - proxy_pass http://strapi; - } - location /content-type-builder { - proxy_pass http://strapi; - } - location /upload { - proxy_pass http://strapi; - } - location /users-permissions { - proxy_pass http://strapi; - } - location /email { - proxy_pass http://strapi; - } - - - location / { - proxy_pass http://nextjs; - } - location /api/nauth { - proxy_pass http://nextjs; - } -}