Este commit está contenido en:
Your Name
2020-05-28 10:40:37 +00:00
padre fbd9d7d5d7
commit 6920fcbd76
Se han modificado 5 ficheros con 608 adiciones y 0 borrados

Ver fichero

@@ -0,0 +1,53 @@
LIBRATO_EMAIL=
LIBRATO_TOKEN=
TWITTER_CLIENT_ID=sqY1bQ3ItgbsLAK1rWpgEOwgy
TWITTER_CLIENT_SECRET=KZjP7ckeUIejNWNZFvAGSJXesCtibd0WDR5IzXtuXgyznSN78Q
SECRET_KEY_BASE=00fec1e38c7acc75aac44e9d4c2229fe1ec94144c86c372fd51a85de742e2016d82521fc0b99a38a770ec72a3c345e76745828b83fb650a1436278bb4a787421
RAILS_ENV=production
RACK_ENV=production
# The name that's going to be displayed in the page, but also in the bottom of toots as the app name (optional)
CROSSPOSTER_APP_NAME=Mastodon Twitter Crossposter
# The domain where the app can be accessed
CROSSPOSTER_DOMAIN=https://crossposter.hatthieves.es
# The repo, if it's a fork (optional)
CROSSPOSTER_REPO=https://github.com/repo-to/crossposter
# The stats page, if exists (optional)
CROSSPOSTER_STATS=https://grafana.hatthieves.es
# The fediverse account where announcements about this instance of the crossposter can be found
CROSSPOSTER_FEDI_ACCOUNT_ADDRESS=https://mastodon.madrid/@hatthieves
CROSSPOSTER_FEDI_ACCOUNT_AT=hatthieves@mastodon.madrid
# Twitter account of the admin of this instance, if exists (optional)
CROSSPOSTER_ADMIN_TWITTER=hatthieves
# Fediverse account that users can use to reach the admin in case of issues
CROSSPOSTER_ADMIN_FEDI_ADDRESS=https://mastodon.madrid/@hatthieves
CROSSPOSTER_ADMIN_FEDI_AT=hatthieves@mastodon.madrid
# If you are using statsd to save metrics, you need the three following variables
STATSD_ENABLED=false
STATSD_HOST=127.0.0.1
STATSD_PORT=8125
# You should only enable one of the following lines at a time
ALLOWED_DOMAIN=mastodon.madrid
BLOCKED_DOMAINS=gab.com
# You can use twitter.activitypub.actor (or your own installation of it) to get nice mentions of twitter's people
# If you enable this, instead of @user@twitter.com, the user will be @user@<ALTERNATIVE_TWITTER_DOMAIN>
USE_ALTERNATIVE_TWITTER_DOMAIN=false
ALTERNATIVE_TWITTER_DOMAIN=twitter.activitypub.actor
DATABASE_URL=postgres://postgres:cr0ssp0st3r.@postgres-crossposter/crossposter
DB_NAME=crossposter
DB_USER=postgres
DB_PASS=cr0ssp0st3r.
REDIS_URL=redis://redis-crossposter:6379/1
RAILS_LOG_TO_STDOUT=enabled
RAILS_MAX_THREADS=5
PORT=3000

Ver fichero

@@ -0,0 +1,12 @@
FROM ruby:2.6
ENV RAILS_ENV production
ENV RACK_ENV production
RUN curl -sL "https://deb.nodesource.com/setup_8.x" | bash -
RUN apt update && apt -y upgrade && apt install -y --allow-downgrades nodejs=8.17.0-1nodesource1 git libidn11-dev libmagic-dev && apt clean
RUN npm i yarn -g
RUN git clone --depth=1 https://github.com/renatolond/mastodon-twitter-poster /crossposter
WORKDIR /crossposter
RUN gem update --system
RUN bin/bundle update --all
RUN bin/bundle install --deployment --without development test
RUN bin/yarn

Ver fichero

@@ -0,0 +1,4 @@
#!/bin/sh
bin/bundle exec rake assets:precompile
bin/bundle exec sidekiq -c 5 -q default &
bin/bundle exec puma -C config/puma.rb

Ver fichero

@@ -0,0 +1,76 @@
version: '2'
services:
crossposter:
image: halkeye/mastodon-twitter-poster
# build: ./crossposter
hostname: crossposter
container_name: crossposter
restart: always
env_file: .env.production
entrypoint:
- /bin/sh
- /entrypoint.sh
volumes:
- ./crossposter/entrypoint.sh:/entrypoint.sh
expose:
- 3000
networks:
mynet:
ipv4_address: 172.7.0.101
postgres:
image: postgres
hostname: postgres-crossposter
container_name: postgres-crossposter
restart: always
shm_size: '1gb'
command: >
-c 'max_connections=150'
-c 'shared_buffers=512MB'
-c 'effective_cache_size=1536MB'
-c 'maintenance_work_mem=128MB'
-c 'checkpoint_completion_target=0.7'
-c 'wal_buffers=16MB'
-c 'default_statistics_target=100'
-c 'random_page_cost=1.1'
-c 'effective_io_concurrency=200'
-c 'work_mem=1747kB'
-c 'min_wal_size=1GB'
-c 'max_wal_size=2GB'
-c 'max_worker_processes=4'
-c 'max_parallel_workers_per_gather=2'
-c 'max_parallel_workers=4'
-c 'autovacuum_max_workers=1'
-c 'autovacuum_work_mem=128MB'
-h '*'
# -c 'statement_timeout=60000'
environment:
- POSTGRES_USER=postgres
- POSTGRES_DB=crossposter
- POSTGRES_PASSWORD=cr0ssp0st3r.
volumes:
- ./data:/var/lib/postgresql/data
expose:
- 5432
networks:
mynet:
ipv4_address: 172.7.0.102
redis:
image: redis
hostname: redis-crossposter
container_name: redis-crossposter
restart: always
volumes:
- ./redis:/data
networks:
mynet:
ipv4_address: 172.7.0.103
networks:
mynet:
driver: bridge
ipam:
config:
- subnet: 172.7.0.0/24

Ver fichero

@@ -0,0 +1,463 @@
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: block_or_allow; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.block_or_allow AS ENUM (
'BLOCK_WITH_WORDS',
'ALLOW_WITH_WORDS'
);
--
-- Name: boost_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.boost_options AS ENUM (
'MASTO_BOOST_DO_NOT_POST',
'MASTO_BOOST_POST_AS_LINK'
);
--
-- Name: masto_mention_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.masto_mention_options AS ENUM (
'MASTO_MENTION_DO_NOT_POST'
);
--
-- Name: masto_reply_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.masto_reply_options AS ENUM (
'MASTO_REPLY_DO_NOT_POST',
'MASTO_REPLY_POST_SELF'
);
--
-- Name: masto_visibility; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.masto_visibility AS ENUM (
'MASTO_PUBLIC',
'MASTO_UNLISTED',
'MASTO_PRIVATE'
);
--
-- Name: quote_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.quote_options AS ENUM (
'QUOTE_DO_NOT_POST',
'QUOTE_POST_AS_LINK',
'QUOTE_POST_AS_OLD_RT',
'QUOTE_POST_AS_OLD_RT_WITH_LINK'
);
--
-- Name: retweet_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.retweet_options AS ENUM (
'RETWEET_DO_NOT_POST',
'RETWEET_POST_AS_LINK',
'RETWEET_POST_AS_OLD_RT',
'RETWEET_POST_AS_OLD_RT_WITH_LINK'
);
--
-- Name: twitter_reply_options; Type: TYPE; Schema: public; Owner: -
--
CREATE TYPE public.twitter_reply_options AS ENUM (
'TWITTER_REPLY_DO_NOT_POST',
'TWITTER_REPLY_POST_SELF'
);
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: authorizations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.authorizations (
id bigint NOT NULL,
provider character varying,
uid character varying,
user_id integer,
token character varying,
secret character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
mastodon_client_id bigint
);
--
-- Name: authorizations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.authorizations_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: authorizations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.authorizations_id_seq OWNED BY public.authorizations.id;
--
-- Name: mastodon_clients; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.mastodon_clients (
id integer NOT NULL,
domain character varying,
client_id character varying,
client_secret character varying,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: mastodon_clients_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.mastodon_clients_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: mastodon_clients_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.mastodon_clients_id_seq OWNED BY public.mastodon_clients.id;
--
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.schema_migrations (
version character varying NOT NULL
);
--
-- Name: statuses; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.statuses (
id bigint NOT NULL,
mastodon_client_id bigint NOT NULL,
masto_id character varying NOT NULL,
tweet_id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL
);
--
-- Name: statuses_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.statuses_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: statuses_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.statuses_id_seq OWNED BY public.statuses.id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.users (
id bigint NOT NULL,
created_at timestamp without time zone NOT NULL,
updated_at timestamp without time zone NOT NULL,
last_toot character varying,
last_tweet bigint,
twitter_last_check timestamp without time zone DEFAULT now(),
mastodon_last_check timestamp without time zone DEFAULT now(),
boost_options public.boost_options DEFAULT 'MASTO_BOOST_DO_NOT_POST'::public.boost_options,
masto_reply_options public.masto_reply_options DEFAULT 'MASTO_REPLY_POST_SELF'::public.masto_reply_options,
masto_mention_options public.masto_mention_options DEFAULT 'MASTO_MENTION_DO_NOT_POST'::public.masto_mention_options,
masto_should_post_private boolean DEFAULT false,
masto_should_post_unlisted boolean DEFAULT false,
posting_from_mastodon boolean DEFAULT false,
posting_from_twitter boolean DEFAULT false,
masto_fix_cross_mention boolean DEFAULT false,
retweet_options public.retweet_options DEFAULT 'RETWEET_POST_AS_OLD_RT_WITH_LINK'::public.retweet_options,
quote_options public.quote_options DEFAULT 'QUOTE_POST_AS_OLD_RT_WITH_LINK'::public.quote_options,
twitter_reply_options public.twitter_reply_options DEFAULT 'TWITTER_REPLY_POST_SELF'::public.twitter_reply_options,
twitter_content_warning character varying,
locked boolean DEFAULT false NOT NULL,
twitter_original_visibility public.masto_visibility,
twitter_retweet_visibility public.masto_visibility DEFAULT 'MASTO_UNLISTED'::public.masto_visibility,
twitter_quote_visibility public.masto_visibility DEFAULT 'MASTO_UNLISTED'::public.masto_visibility,
twitter_word_list character varying[] DEFAULT '{}'::character varying[],
twitter_block_or_allow_list public.block_or_allow,
masto_word_list character varying[] DEFAULT '{}'::character varying[],
masto_block_or_allow_list public.block_or_allow,
admin boolean DEFAULT false NOT NULL
);
--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE public.users_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
--
-- Name: authorizations id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.authorizations ALTER COLUMN id SET DEFAULT nextval('public.authorizations_id_seq'::regclass);
--
-- Name: mastodon_clients id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.mastodon_clients ALTER COLUMN id SET DEFAULT nextval('public.mastodon_clients_id_seq'::regclass);
--
-- Name: statuses id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.statuses ALTER COLUMN id SET DEFAULT nextval('public.statuses_id_seq'::regclass);
--
-- Name: users id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
--
-- Name: ar_internal_metadata ar_internal_metadata_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.ar_internal_metadata
ADD CONSTRAINT ar_internal_metadata_pkey PRIMARY KEY (key);
--
-- Name: authorizations authorizations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.authorizations
ADD CONSTRAINT authorizations_pkey PRIMARY KEY (id);
--
-- Name: mastodon_clients mastodon_clients_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.mastodon_clients
ADD CONSTRAINT mastodon_clients_pkey PRIMARY KEY (id);
--
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.schema_migrations
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
--
-- Name: statuses statuses_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.statuses
ADD CONSTRAINT statuses_pkey PRIMARY KEY (id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
--
-- Name: index_authorizations_on_mastodon_client_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_authorizations_on_mastodon_client_id ON public.authorizations USING btree (mastodon_client_id);
--
-- Name: index_authorizations_on_provider_and_uid; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_authorizations_on_provider_and_uid ON public.authorizations USING btree (provider, uid);
--
-- Name: index_mastodon_clients_on_domain; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_mastodon_clients_on_domain ON public.mastodon_clients USING btree (domain);
--
-- Name: index_statuses_on_mastodon_client_id; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_statuses_on_mastodon_client_id ON public.statuses USING btree (mastodon_client_id);
--
-- Name: index_statuses_on_mastodon_client_id_and_masto_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_statuses_on_mastodon_client_id_and_masto_id ON public.statuses USING btree (mastodon_client_id, masto_id);
--
-- Name: index_statuses_on_tweet_id; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_statuses_on_tweet_id ON public.statuses USING btree (tweet_id);
--
-- Name: statuses fk_rails_68a10127d4; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.statuses
ADD CONSTRAINT fk_rails_68a10127d4 FOREIGN KEY (mastodon_client_id) REFERENCES public.mastodon_clients(id);
--
-- Name: authorizations fk_rails_7cfd93d6c7; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.authorizations
ADD CONSTRAINT fk_rails_7cfd93d6c7 FOREIGN KEY (mastodon_client_id) REFERENCES public.mastodon_clients(id);
--
-- PostgreSQL database dump complete
--
SET search_path TO "$user", public;
INSERT INTO "schema_migrations" (version) VALUES
('20170808112347'),
('20170808113938'),
('20170808114609'),
('20170809135336'),
('20170809151828'),
('20170810091710'),
('20170810094031'),
('20170810103418'),
('20170810105204'),
('20170810105214'),
('20170812195419'),
('20170817073406'),
('20171012093059'),
('20171025115156'),
('20171025125328'),
('20171102154204'),
('20171103102943'),
('20171103132222'),
('20171123155339'),
('20171123191320'),
('20180103212954'),
('20180304150232'),
('20180412164151'),
('20180503105007'),
('20180503110516'),
('20180701100749'),
('20180821172252'),
('20190131082017'),
('20190202145018'),
('20190226132236');