Page MenuHomePhorge

No OneTemporary

Size
5 KB
Referenced Files
None
Subscribers
None
diff --git a/.buildpacks b/.buildpacks
new file mode 100644
index 000000000..31dd57096
--- /dev/null
+++ b/.buildpacks
@@ -0,0 +1 @@
+https://github.com/hashnuke/heroku-buildpack-elixir
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8b5131dc3..53f05ae92 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,97 +1,144 @@
image: elixir:1.8.1
variables:
POSTGRES_DB: pleroma_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DB_HOST: postgres
MIX_ENV: test
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- deps
- _build
stages:
- build
- test
- deploy
before_script:
- mix local.hex --force
- mix local.rebar --force
build:
stage: build
script:
- mix deps.get
- mix compile --force
docs-build:
stage: build
only:
- master@pleroma/pleroma
- develop@pleroma/pleroma
variables:
MIX_ENV: dev
script:
- mix deps.get
- mix compile
- mix docs
artifacts:
paths:
- priv/static/doc
unit-testing:
stage: test
services:
- name: lainsoykaf/postgres-with-rum
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script:
- mix deps.get
- mix ecto.create
- mix ecto.migrate
- mix test --trace --preload-modules
- mix coveralls
unit-testing-rum:
stage: test
services:
- name: lainsoykaf/postgres-with-rum
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
variables:
RUM_ENABLED: "true"
script:
- mix deps.get
- mix ecto.create
- mix ecto.migrate
- "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
- mix test --trace --preload-modules
lint:
stage: test
script:
- mix format --check-formatted
analysis:
stage: test
script:
- mix deps.get
- mix credo --strict --only=warnings,todo,fixme,consistency,readability
docs-deploy:
stage: deploy
image: alpine:3.9
only:
- master@pleroma/pleroma
- develop@pleroma/pleroma
before_script:
- apk update && apk add openssh-client rsync
script:
- mkdir -p ~/.ssh
- echo "${SSH_HOST_KEY}" > ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- rsync -hrvz --delete -e "ssh -p ${SSH_PORT}" priv/static/doc/ "${SSH_USER_HOST_LOCATION}/${CI_COMMIT_REF_NAME}"
+
+review_app:
+ image: alpine:3.9
+ stage: deploy
+ before_script:
+ - apk update && apk add openssh-client git
+ when: manual
+ environment:
+ name: review/$CI_COMMIT_REF_NAME
+ url: https://$CI_ENVIRONMENT_SLUG.pleroma.online/
+ on_stop: stop_review_app
+ only:
+ - branches
+ except:
+ - master
+ - develop
+ script:
+ - echo "$CI_ENVIRONMENT_SLUG"
+ - mkdir -p ~/.ssh
+ - eval $(ssh-agent -s)
+ - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+ - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
+ - (ssh -t dokku@pleroma.online -- apps:create "$CI_ENVIRONMENT_SLUG") || true
+ - ssh -t dokku@pleroma.online -- config:set "$CI_ENVIRONMENT_SLUG" APP_NAME="$CI_ENVIRONMENT_SLUG" APP_HOST="$CI_ENVIRONMENT_SLUG.pleroma.online" MIX_ENV=dokku
+ - (ssh -t dokku@pleroma.online -- postgres:create $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db) || true
+ - (ssh -t dokku@pleroma.online -- postgres:link $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db "$CI_ENVIRONMENT_SLUG") || true
+ - (ssh -t dokku@pleroma.online -- certs:add "$CI_ENVIRONMENT_SLUG" /home/dokku/server.crt /home/dokku/server.key) || true
+ - (git remote add dokku dokku@pleroma.online:$CI_ENVIRONMENT_SLUG) || true
+ - git push -f dokku $CI_COMMIT_SHA:refs/heads/master
+
+stop_review_app:
+ image: alpine:3.9
+ stage: deploy
+ before_script:
+ - apk update && apk add openssh-client git
+ when: manual
+ environment:
+ name: review/$CI_COMMIT_REF_NAME
+ action: stop
+ script:
+ - echo "$CI_ENVIRONMENT_SLUG"
+ - mkdir -p ~/.ssh
+ - eval $(ssh-agent -s)
+ - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+ - ssh-keyscan -H "pleroma.online" >> ~/.ssh/known_hosts
+ - ssh -t dokku@pleroma.online -- --force apps:destroy "$CI_ENVIRONMENT_SLUG"
+ - ssh -t dokku@pleroma.online -- --force postgres:destroy $(echo $CI_ENVIRONMENT_SLUG | sed -e 's/-/_/g')_db
diff --git a/Procfile b/Procfile
new file mode 100644
index 000000000..7ac187baa
--- /dev/null
+++ b/Procfile
@@ -0,0 +1,2 @@
+web: mix phx.server
+release: mix ecto.migrate
diff --git a/config/dokku.exs b/config/dokku.exs
new file mode 100644
index 000000000..9ea0ec450
--- /dev/null
+++ b/config/dokku.exs
@@ -0,0 +1,25 @@
+use Mix.Config
+
+config :pleroma, Pleroma.Web.Endpoint,
+ http: [
+ port: String.to_integer(System.get_env("PORT") || "4000"),
+ protocol_options: [max_request_line_length: 8192, max_header_value_length: 8192]
+ ],
+ protocol: "http",
+ secure_cookie_flag: false,
+ url: [host: System.get_env("APP_HOST"), scheme: "https", port: 443],
+ secret_key_base: "+S+ULgf7+N37c/lc9K66SMphnjQIRGklTu0BRr2vLm2ZzvK0Z6OH/PE77wlUNtvP"
+
+database_url =
+ System.get_env("DATABASE_URL") ||
+ raise """
+ environment variable DATABASE_URL is missing.
+ For example: ecto://USER:PASS@HOST/DATABASE
+ """
+
+config :pleroma, Pleroma.Repo,
+ # ssl: true,
+ url: database_url,
+ pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10")
+
+config :pleroma, :instance, name: "#{System.get_env("APP_NAME")} CI Instance"
diff --git a/elixir_buildpack.config b/elixir_buildpack.config
new file mode 100644
index 000000000..c23b08fb8
--- /dev/null
+++ b/elixir_buildpack.config
@@ -0,0 +1,2 @@
+elixir_version=1.8.2
+erlang_version=21.3.7

File Metadata

Mime Type
text/x-diff
Expires
Mon, Nov 25, 5:36 AM (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
39630
Default Alt Text
(5 KB)

Event Timeline